public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] Staging: generic_serial: fix double locking bug
@ 2011-02-28 19:28 Dan Carpenter
  2011-02-28 21:06 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2011-02-28 19:28 UTC (permalink / raw)
  To: kernel-janitors

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>
---
Oh.  Crap.  I don't want to adopt these drivers.  But I already wrote
the patch before I read the TODO file, so I'm still going to submit it.

diff --git a/drivers/staging/generic_serial/generic_serial.c b/drivers/staging/generic_serial/generic_serial.c
index 5954ee1..466988d 100644
--- a/drivers/staging/generic_serial/generic_serial.c
+++ b/drivers/staging/generic_serial/generic_serial.c
@@ -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 */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] Staging: generic_serial: fix double locking bug
  2011-02-28 19:28 [patch] Staging: generic_serial: fix double locking bug Dan Carpenter
@ 2011-02-28 21:06 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2011-02-28 21:06 UTC (permalink / raw)
  To: kernel-janitors

On Mon, Feb 28, 2011 at 10:28:31PM +0300, Dan Carpenter wrote:
> 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>
> ---
> Oh.  Crap.  I don't want to adopt these drivers.  But I already wrote
> the patch before I read the TODO file, so I'm still going to submit it.

Heh, don't worry, you don't "own" them, I'll just take this fix for now
and still leave them in the "abandoned" category :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-28 21:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-28 19:28 [patch] Staging: generic_serial: fix double locking bug Dan Carpenter
2011-02-28 21:06 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox