Commit c3def5ce authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Wen Zhiwei
Browse files

Revert "usb: gadget: u_serial: Disable ep before setting port to null to fix...

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

stable inclusion
from stable-v6.6.75
commit 3d8f4dc8c78ffd77a4106614977c1e51531690f7
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBSPQB

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3d8f4dc8c78ffd77a4106614977c1e51531690f7

--------------------------------

commit 086fd062bc3883ae1ce4166cff5355db315ad879 upstream.

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: default avatarJon 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: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarWen Zhiwei <wenzhiwei@kylinos.cn>
parent c63b0084
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1398,10 +1398,6 @@ void gserial_disconnect(struct gserial *gser)
	/* REVISIT as above: how best to track this? */
	port->port_line_coding = gser->port_line_coding;

	/* disable endpoints, aborting down any active I/O */
	usb_ep_disable(gser->out);
	usb_ep_disable(gser->in);

	port->port_usb = NULL;
	gser->ioport = NULL;
	if (port->port.count > 0) {
@@ -1413,6 +1409,10 @@ void gserial_disconnect(struct gserial *gser)
	spin_unlock(&port->port_lock);
	spin_unlock_irqrestore(&serial_port_lock, flags);

	/* disable endpoints, aborting down any active I/O */
	usb_ep_disable(gser->out);
	usb_ep_disable(gser->in);

	/* finally, free any unused/unusable I/O buffers */
	spin_lock_irqsave(&port->port_lock, flags);
	if (port->port.count == 0)