lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Mon, 3 Jun 2024 15:13:04 +0200
From: Mike Looijmans <mike.looijmans@...ic.nl>
To: linux-usb@...r.kernel.org
CC: Mike Looijmans <mike.looijmans@...ic.nl>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] usb: dwc3: gadget: Inform system of suspended state

When disconnecting the USB cable on an LS1028 device, nothing happens
in userspace, which keeps thinking everything is still up and running.
Turns out that the DWC3 controller only sends DWC3_DEVICE_EVENT_SUSPEND
in that case, and not a DWC3_DEVICE_EVENT_DISCONNECT as one would
expect. As a result, sysfs attribute "state" remains "configured"
until something resets it.

Forward the "suspended" state to sysfs, so that the "state" at least
changes into "suspended" when one removes the cable, and hence also
matches the gadget's state when really suspended.

Signed-off-by: Mike Looijmans <mike.looijmans@...ic.nl>
---

 drivers/usb/dwc3/gadget.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4df2661f6675..99e8ea9db600 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -4343,6 +4343,7 @@ static void dwc3_gadget_suspend_interrupt(struct dwc3 *dwc,
 	if (!dwc->suspended && next == DWC3_LINK_STATE_U3) {
 		dwc->suspended = true;
 		dwc3_suspend_gadget(dwc);
+		usb_gadget_set_state(dwc->gadget, USB_STATE_SUSPENDED);
 	}
 
 	dwc->link_state = next;
-- 
2.34.1


Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: mike.looijmans@...ic.nl
W: www.topic.nl

Please consider the environment before printing this e-mail

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ