This is a note to let you know that I've just added the patch titled
USB: ti_usb_3410_5052: fix use-after-free in TIOCMIWAIT
to the 3.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
usb-ti_usb_3410_5052-fix-use-after-free-in-tiocmiwait.patch
and it can be found in the queue-3.8 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From fc98ab873aa3dbe783ce56a2ffdbbe7c7609521a Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Tue, 19 Mar 2013 09:21:26 +0100
Subject: USB: ti_usb_3410_5052: fix use-after-free in TIOCMIWAIT
From: Johan Hovold <[email protected]>
commit fc98ab873aa3dbe783ce56a2ffdbbe7c7609521a upstream.
Use the port wait queue and make sure to check the serial disconnected
flag before accessing private port data after waking up.
This is is needed as the private port data (including the wait queue
itself) can be gone when waking up after a disconnect.
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/usb/serial/ti_usb_3410_5052.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -74,7 +74,6 @@ struct ti_port {
int tp_flags;
int tp_closing_wait;/* in .01 secs */
struct async_icount tp_icount;
- wait_queue_head_t tp_msr_wait; /* wait for msr change */
wait_queue_head_t tp_write_wait;
struct ti_device *tp_tdev;
struct usb_serial_port *tp_port;
@@ -432,7 +431,6 @@ static int ti_port_probe(struct usb_seri
else
tport->tp_uart_base_addr = TI_UART2_BASE_ADDR;
tport->tp_closing_wait = closing_wait;
- init_waitqueue_head(&tport->tp_msr_wait);
init_waitqueue_head(&tport->tp_write_wait);
if (kfifo_alloc(&tport->write_fifo, TI_WRITE_BUF_SIZE, GFP_KERNEL)) {
kfree(tport);
@@ -784,9 +782,13 @@ static int ti_ioctl(struct tty_struct *t
dev_dbg(&port->dev, "%s - TIOCMIWAIT\n", __func__);
cprev = tport->tp_icount;
while (1) {
- interruptible_sleep_on(&tport->tp_msr_wait);
+ interruptible_sleep_on(&port->delta_msr_wait);
if (signal_pending(current))
return -ERESTARTSYS;
+
+ if (port->serial->disconnected)
+ return -EIO;
+
cnow = tport->tp_icount;
if (cnow.rng == cprev.rng && cnow.dsr == cprev.dsr &&
cnow.dcd == cprev.dcd && cnow.cts == cprev.cts)
@@ -1400,7 +1402,7 @@ static void ti_handle_new_msr(struct ti_
icount->dcd++;
if (msr & TI_MSR_DELTA_RI)
icount->rng++;
- wake_up_interruptible(&tport->tp_msr_wait);
+ wake_up_interruptible(&tport->tp_port->delta_msr_wait);
spin_unlock_irqrestore(&tport->tp_lock, flags);
}
Patches currently in stable-queue which might be from [email protected] are
queue-3.8/usb-quatech2-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-ark3116-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-cypress_m8-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-pl2303-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-io_edgeport-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-ch341-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-mos7840-fix-broken-tiocmiwait.patch
queue-3.8/usb-spcp8x5-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-ti_usb_3410_5052-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-serial-fix-hang-when-opening-port.patch
queue-3.8/usb-f81232-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-mct_u232-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-oti6858-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-ftdi_sio-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-serial-add-modem-status-change-wait-queue.patch
queue-3.8/usb-io_ti-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-ssu100-fix-use-after-free-in-tiocmiwait.patch
queue-3.8/usb-mos7840-fix-use-after-free-in-tiocmiwait.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html