patch "USB: serial: quatech2: handle unbound ports" added to usb-linus
Subsystems (3)
This is a note to let you know that I've just added the patch titled
USB: serial: quatech2: handle unbound ports
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-linus branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will hopefully also be merged in Linus's tree for the next -rc kernel release.
If you have any questions about this process, please let me know.
From 9715a43eea77e42678a1002623f2d9a78f5b81a1 Mon Sep 17 00:00:00 2001
From: Johan Hovold <[email protected]>
Date: Fri, 17 Jan 2020 15:35:26 +0100
Subject: USB: serial: quatech2: handle unbound ports
Check for NULL port data in the modem- and line-status handlers to avoid dereferencing a NULL pointer in the unlikely case where a port device isn't bound to a driver (e.g. after an allocation failure on port probe).
Note that the other (stubbed) event handlers qt2_process_xmit_empty() and qt2_process_flush() would need similar sanity checks in case they are ever implemented.
--- drivers/usb/serial/quatech2.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/serial/quatech2.c +6 -0
@@ -841,7 +841,10 @@ static void qt2_update_msr(struct usb_serial_port *port, unsigned char *ch)u8 newMSR = (u8) *ch;unsigned long flags; +/* May be called from qt2_process_read_urb() for an unbound port. */ port_priv =usb_get_serial_port_data (port); +if (!port_priv) +return ;spin_lock_irqsave (&port_priv->lock, flags); port_priv->shadowMSR = newMSR;
@@ -869,7 +872,10 @@ static void qt2_update_lsr(struct usb_serial_port *port, unsigned char *ch)unsigned long flags;u8 newLSR = (u8) *ch; +/* May be called from qt2_process_read_urb() for an unbound port. */ port_priv =usb_get_serial_port_data (port); +if (!port_priv) +return ;if (newLSR &UART_LSR_BI ) newLSR &= (u8) (UART_LSR_OE |UART_LSR_BI );
Signature · 1 line
2.25.0