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]
Message-ID: <20070802235613.GA9487@srcf.ucam.org>
Date:	Fri, 3 Aug 2007 00:56:13 +0100
From:	Matthew Garrett <mjg59@...f.ucam.org>
To:	linux-usb-devel@...ts.sourceforge.net
Cc:	gregkh@...e.de, amitk@...ntu.com, linux-kernel@...r.kernel.org
Subject: [PATCH] USB: Only enable autosuspend by default on certain device classes

We're seeing a large number of problems with devices not appreciating 
USB autosuspend, especially printers and scanners. According to 
http://www.microsoft.com/whdc/system/bus/USB/USBFAQ_intro.mspx only a 
subset of drivers support it in Windows XP, meaning that most devices 
are probably untested in this situation. This patch alters the behaviour 
to match that of Windows. Userspace can still whitelist devices as 
appropriate, and the set of classes supporting autosuspend probably 
covers pretty much every driver likely to be found on any portable 
device.

Signed-off-by: Matthew Garrett <mjg59@...f.ucam.org>

---

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index caaa46f..12ba789 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1278,6 +1278,22 @@ int usb_new_device(struct usb_device *udev)
 {
 	int err;
 
+#ifdef CONFIG_USB_SUSPEND
+	/* Disable autosuspend for most devices - Windows only enables it
+	   for a small subset of classes, so most hardware hasn't been tested
+	   with it. Userspace can always reenable at a later point */
+
+	switch (udev->descriptor.bDeviceClass) {
+	case USB_CLASS_HID:
+	case USB_CLASS_COMM:
+	case USB_CLASS_WIRELESS_CONTROLLER:
+	case USB_CLASS_HUB:
+		break;
+	default:
+		udev->autosuspend_disabled = 1;
+	}
+#endif
+
 	/* Determine quirks */
 	usb_detect_quirks(udev);


-- 
Matthew Garrett | mjg59@...f.ucam.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ