[PATCH] USB: serial: f81232: drain work on failed open

From: Haowen Tu

Date: Mon Nov 16 2026 - 00:11:23 EST


The interrupt URB is submitted before usb_serial_generic_open() starts
the bulk read URBs. A modem-status notification can therefore queue
interrupt_work before a bulk read submission fails. A bulk read that
completes before a later submission fails can also queue lsr_work.

The error path kills the interrupt URB but does not drain either work
item. The tty port is not initialized after a failed open, so the close
callback, which normally flushes this work, is not called. If the device
is then disconnected, the work can outlive the port private data it uses.

Flush both work items after killing the interrupt URB. The generic open
error path has already killed any submitted bulk read URBs, so neither
source can queue more work at this point.

Fixes: 87fe5adcd8de ("USB: f81232: implement read IIR/MSR with endpoint")
Signed-off-by: Haowen Tu <tuhaowen@xxxxxxxxxxxxx>
---
drivers/usb/serial/f81232.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/usb/serial/f81232.c b/drivers/usb/serial/f81232.c
index 9a3ede35a3d9..b62e93e7612c 100644
--- a/drivers/usb/serial/f81232.c
+++ b/drivers/usb/serial/f81232.c
@@ -695,6 +695,7 @@ static int f81232_tiocmset(struct tty_struct *tty,

static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
{
+ struct f81232_private *priv = usb_get_serial_port_data(port);
int result;

result = f81232_port_enable(port);
@@ -715,6 +716,8 @@ static int f81232_open(struct tty_struct *tty, struct usb_serial_port *port)
result = usb_serial_generic_open(tty, port);
if (result) {
usb_kill_urb(port->interrupt_in_urb);
+ flush_work(&priv->interrupt_work);
+ flush_work(&priv->lsr_work);
return result;
}

--
2.50.1