Skip to content

Commit

Permalink
Staging: generic_serial: fix double locking bug
Browse files Browse the repository at this point in the history
spin_lock_irqsave() is not nestable.  The second time that it gets
called it overwrites the "flags" variable and so IRQs can't be restored
properly.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Feb 28, 2011
1 parent 2c590f3 commit c976cc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/generic_serial/generic_serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ void gs_close(struct tty_struct * tty, struct file * filp)
* line status register.
*/

spin_lock_irqsave(&port->driver_lock, flags);
spin_lock(&port->driver_lock);
port->rd->disable_rx_interrupts (port);
spin_unlock_irqrestore(&port->driver_lock, flags);
spin_unlock(&port->driver_lock);
spin_unlock_irqrestore(&port->port.lock, flags);

/* close has no way of returning "EINTR", so discard return value */
Expand Down

0 comments on commit c976cc3

Please sign in to comment.