Commit 5ff7205d authored by Jiri Slaby's avatar Jiri Slaby Committed by Linus Torvalds

[PATCH] Char: mxser_new, lock count and flags

Both open count and INITIALIZED flag should be changed under lock.
Signed-off-by: default avatarJiri Slaby <jirislaby@gmail.com>
Cc: <osv@javad.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 722d5e4a
...@@ -853,9 +853,9 @@ static int mxser_startup(struct mxser_port *info) ...@@ -853,9 +853,9 @@ static int mxser_startup(struct mxser_port *info)
* and set the speed of the serial port * and set the speed of the serial port
*/ */
mxser_change_speed(info, NULL); mxser_change_speed(info, NULL);
info->flags |= ASYNC_INITIALIZED;
spin_unlock_irqrestore(&info->slock, flags); spin_unlock_irqrestore(&info->slock, flags);
info->flags |= ASYNC_INITIALIZED;
return 0; return 0;
} }
...@@ -925,6 +925,7 @@ static void mxser_shutdown(struct mxser_port *info) ...@@ -925,6 +925,7 @@ static void mxser_shutdown(struct mxser_port *info)
static int mxser_open(struct tty_struct *tty, struct file *filp) static int mxser_open(struct tty_struct *tty, struct file *filp)
{ {
struct mxser_port *info; struct mxser_port *info;
unsigned long flags;
int retval, line; int retval, line;
line = tty->index; line = tty->index;
...@@ -941,7 +942,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp) ...@@ -941,7 +942,9 @@ static int mxser_open(struct tty_struct *tty, struct file *filp)
/* /*
* Start up serial port * Start up serial port
*/ */
spin_lock_irqsave(&info->slock, flags);
info->count++; info->count++;
spin_unlock_irqrestore(&info->slock, flags);
retval = mxser_startup(info); retval = mxser_startup(info);
if (retval) if (retval)
return retval; return retval;
......
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