]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
2df5ebc0cdc4a8e5f0ef6e92b0fb47f22ac33d93
[thirdparty/kernel/stable-queue.git] /
1 From 086fd062bc3883ae1ce4166cff5355db315ad879 Mon Sep 17 00:00:00 2001
2 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
3 Date: Fri, 17 Jan 2025 09:17:12 +0100
4 Subject: Revert "usb: gadget: u_serial: Disable ep before setting port to null to fix the crash caused by port being null"
5
6 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7
8 commit 086fd062bc3883ae1ce4166cff5355db315ad879 upstream.
9
10 This reverts commit 13014969cbf07f18d62ceea40bd8ca8ec9d36cec.
11
12 It is reported to cause crashes on Tegra systems, so revert it for now.
13
14 Link: https://lore.kernel.org/r/1037c1ad-9230-4181-b9c3-167dbaa47644@nvidia.com
15 Reported-by: Jon Hunter <jonathanh@nvidia.com>
16 Cc: stable <stable@kernel.org>
17 Cc: Lianqin Hu <hulianqin@vivo.com>
18 Link: https://lore.kernel.org/r/2025011711-yippee-fever-a737@gregkh
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20 ---
21 drivers/usb/gadget/function/u_serial.c | 8 ++++----
22 1 file changed, 4 insertions(+), 4 deletions(-)
23
24 --- a/drivers/usb/gadget/function/u_serial.c
25 +++ b/drivers/usb/gadget/function/u_serial.c
26 @@ -1420,10 +1420,6 @@ void gserial_disconnect(struct gserial *
27 /* REVISIT as above: how best to track this? */
28 port->port_line_coding = gser->port_line_coding;
29
30 - /* disable endpoints, aborting down any active I/O */
31 - usb_ep_disable(gser->out);
32 - usb_ep_disable(gser->in);
33 -
34 port->port_usb = NULL;
35 gser->ioport = NULL;
36 if (port->port.count > 0) {
37 @@ -1435,6 +1431,10 @@ void gserial_disconnect(struct gserial *
38 spin_unlock(&port->port_lock);
39 spin_unlock_irqrestore(&serial_port_lock, flags);
40
41 + /* disable endpoints, aborting down any active I/O */
42 + usb_ep_disable(gser->out);
43 + usb_ep_disable(gser->in);
44 +
45 /* finally, free any unused/unusable I/O buffers */
46 spin_lock_irqsave(&port->port_lock, flags);
47 if (port->port.count == 0)