From 6e28d28d01f62f1b879784dceadab067d505cf95 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 14 Nov 2007 14:32:16 -0800 Subject: [PATCH] one more .23 patch --- queue-2.6.23/series | 1 + ...ntial-deadlock-between-write-and-irq.patch | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 queue-2.6.23/usb-usbserial-fix-potential-deadlock-between-write-and-irq.patch diff --git a/queue-2.6.23/series b/queue-2.6.23/series index 958b66f59e0..844bf80e516 100644 --- a/queue-2.6.23/series +++ b/queue-2.6.23/series @@ -110,3 +110,4 @@ zd1201-avoid-null-ptr-access-of-skb-dev.patch ipw2100-send-wext-scan-events.patch rtl8187-fix-more-frag-bit-checking-rts-duration-calc.patch zd1211rw-fix-oops-when-ejecting-install-media.patch +usb-usbserial-fix-potential-deadlock-between-write-and-irq.patch diff --git a/queue-2.6.23/usb-usbserial-fix-potential-deadlock-between-write-and-irq.patch b/queue-2.6.23/usb-usbserial-fix-potential-deadlock-between-write-and-irq.patch new file mode 100644 index 00000000000..9c82a76fdb4 --- /dev/null +++ b/queue-2.6.23/usb-usbserial-fix-potential-deadlock-between-write-and-irq.patch @@ -0,0 +1,46 @@ +From acd2a847e7fee7df11817f67dba75a2802793e5d Mon Sep 17 00:00:00 2001 +From: Jiri Kosina +Date: Sat, 20 Oct 2007 00:05:19 +0200 +Subject: USB: usbserial - fix potential deadlock between write() and IRQ +Message-ID: <20071102152622.GB7279@kroah.com> + +From: Jiri Kosina + +patch acd2a847e7fee7df11817f67dba75a2802793e5d in mainline. + +USB: usbserial - fix potential deadlock between write() and IRQ + +usb_serial_generic_write() doesn't disable interrupts when taking port->lock, +and could therefore deadlock with usb_serial_generic_read_bulk_callback() +being called from interrupt, taking the same lock. Fix it. + +Signed-off-by: Jiri Kosina +Acked-by: Larry Finger +Cc: Marcin Slusarz +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/usb/serial/generic.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/usb/serial/generic.c ++++ b/drivers/usb/serial/generic.c +@@ -208,14 +208,15 @@ int usb_serial_generic_write(struct usb_ + + /* only do something if we have a bulk out endpoint */ + if (serial->num_bulk_out) { +- spin_lock_bh(&port->lock); ++ unsigned long flags; ++ spin_lock_irqsave(&port->lock, flags); + if (port->write_urb_busy) { +- spin_unlock_bh(&port->lock); ++ spin_unlock_irqrestore(&port->lock, flags); + dbg("%s - already writing", __FUNCTION__); + return 0; + } + port->write_urb_busy = 1; +- spin_unlock_bh(&port->lock); ++ spin_unlock_irqrestore(&port->lock, flags); + + count = (count > port->bulk_out_size) ? port->bulk_out_size : count; + -- 2.47.2