Commit ec82db12 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

isicom: kill off the BKL

As with the others we can use the port mutex to get the needed locking
properties and fix the race with open.
Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bf936f92
...@@ -124,7 +124,6 @@ ...@@ -124,7 +124,6 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/sched.h> #include <linux/sched.h>
#include <linux/serial.h> #include <linux/serial.h>
#include <linux/smp_lock.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/timer.h> #include <linux/timer.h>
...@@ -872,7 +871,6 @@ static struct tty_port *isicom_find_port(struct tty_struct *tty) ...@@ -872,7 +871,6 @@ static struct tty_port *isicom_find_port(struct tty_struct *tty)
static int isicom_open(struct tty_struct *tty, struct file *filp) static int isicom_open(struct tty_struct *tty, struct file *filp)
{ {
struct isi_port *port; struct isi_port *port;
struct isi_board *card;
struct tty_port *tport; struct tty_port *tport;
tport = isicom_find_port(tty); tport = isicom_find_port(tty);
...@@ -1118,8 +1116,7 @@ static int isicom_set_serial_info(struct tty_struct *tty, ...@@ -1118,8 +1116,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
if (copy_from_user(&newinfo, info, sizeof(newinfo))) if (copy_from_user(&newinfo, info, sizeof(newinfo)))
return -EFAULT; return -EFAULT;
lock_kernel(); mutex_lock(&port->port.mutex);
reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) != reconfig_port = ((port->port.flags & ASYNC_SPD_MASK) !=
(newinfo.flags & ASYNC_SPD_MASK)); (newinfo.flags & ASYNC_SPD_MASK));
...@@ -1128,7 +1125,7 @@ static int isicom_set_serial_info(struct tty_struct *tty, ...@@ -1128,7 +1125,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
(newinfo.closing_wait != port->port.closing_wait) || (newinfo.closing_wait != port->port.closing_wait) ||
((newinfo.flags & ~ASYNC_USR_MASK) != ((newinfo.flags & ~ASYNC_USR_MASK) !=
(port->port.flags & ~ASYNC_USR_MASK))) { (port->port.flags & ~ASYNC_USR_MASK))) {
unlock_kernel(); mutex_unlock(&port->port.mutex);
return -EPERM; return -EPERM;
} }
port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) | port->port.flags = ((port->port.flags & ~ASYNC_USR_MASK) |
...@@ -1145,7 +1142,7 @@ static int isicom_set_serial_info(struct tty_struct *tty, ...@@ -1145,7 +1142,7 @@ static int isicom_set_serial_info(struct tty_struct *tty,
isicom_config_port(tty); isicom_config_port(tty);
spin_unlock_irqrestore(&port->card->card_lock, flags); spin_unlock_irqrestore(&port->card->card_lock, flags);
} }
unlock_kernel(); mutex_unlock(&port->port.mutex);
return 0; return 0;
} }
...@@ -1154,7 +1151,7 @@ static int isicom_get_serial_info(struct isi_port *port, ...@@ -1154,7 +1151,7 @@ static int isicom_get_serial_info(struct isi_port *port,
{ {
struct serial_struct out_info; struct serial_struct out_info;
lock_kernel(); mutex_lock(&port->port.mutex);
memset(&out_info, 0, sizeof(out_info)); memset(&out_info, 0, sizeof(out_info));
/* out_info.type = ? */ /* out_info.type = ? */
out_info.line = port - isi_ports; out_info.line = port - isi_ports;
...@@ -1164,7 +1161,7 @@ static int isicom_get_serial_info(struct isi_port *port, ...@@ -1164,7 +1161,7 @@ static int isicom_get_serial_info(struct isi_port *port,
/* out_info.baud_base = ? */ /* out_info.baud_base = ? */
out_info.close_delay = port->port.close_delay; out_info.close_delay = port->port.close_delay;
out_info.closing_wait = port->port.closing_wait; out_info.closing_wait = port->port.closing_wait;
unlock_kernel(); mutex_unlock(&port->port.mutex);
if (copy_to_user(info, &out_info, sizeof(out_info))) if (copy_to_user(info, &out_info, sizeof(out_info)))
return -EFAULT; return -EFAULT;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment