Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Revert "usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null"

This reverts commit 13014969cbf07f18d62ceea40bd8ca8ec9d36cec.

It is reported to cause crashes on Tegra systems, so revert it for now.

Link: https://lore.kernel.org/r/1037c1ad-9230-4181-b9c3-167dbaa47644@nvidia.com
Reported-by: Jon Hunter <jonathanh@nvidia.com>
Cc: stable <stable@kernel.org>
Cc: Lianqin Hu <hulianqin@vivo.com>
Link: https://lore.kernel.org/r/2025011711-yippee-fever-a737@gregkh
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+4 -4
+4 -4
drivers/usb/gadget/function/u_serial.c
··· 1421 1421 /* REVISIT as above: how best to track this? */ 1422 1422 port->port_line_coding = gser->port_line_coding; 1423 1423 1424 - /* disable endpoints, aborting down any active I/O */ 1425 - usb_ep_disable(gser->out); 1426 - usb_ep_disable(gser->in); 1427 - 1428 1424 port->port_usb = NULL; 1429 1425 gser->ioport = NULL; 1430 1426 if (port->port.count > 0) { ··· 1431 1435 port->suspended = false; 1432 1436 spin_unlock(&port->port_lock); 1433 1437 spin_unlock_irqrestore(&serial_port_lock, flags); 1438 + 1439 + /* disable endpoints, aborting down any active I/O */ 1440 + usb_ep_disable(gser->out); 1441 + usb_ep_disable(gser->in); 1434 1442 1435 1443 /* finally, free any unused/unusable I/O buffers */ 1436 1444 spin_lock_irqsave(&port->port_lock, flags);