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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20101212234639.6CED9B27BF@basil.firstfloor.org>
Date:	Mon, 13 Dec 2010 00:46:39 +0100 (CET)
From:	Andi Kleen <andi@...stfloor.org>
To:	tom.leiming@...il.com, dbrownell@...rs.sourceforge.net,
	davem@...emloft.net, ben@...adent.org.uk, joe@...ches.com,
	oliver@...kum.org, andy.shevchenko@...il.com, davem@...emloft.net,
	gregkh@...e.de, ak@...ux.intel.com, linux-kernel@...r.kernel.org,
	stable@...nel.org
Subject: [PATCH] [99/223] usbnet: fix usb_autopm_get_interface failure(v1)

2.6.35-longterm review patch.  If anyone has any objections, please let me know.

------------------
From: Ming Lei <tom.leiming@...il.com>

commit b0786b430c982dffbb44d8030e6b6088671ce745 upstream.

Since usbnet already took usb runtime pm, we have to
enable runtime pm for usb interface of usbnet, otherwise
usb_autopm_get_interface may return failure and cause
'ifconfig usb0 up' failed if USB_SUSPEND(RUNTIME_PM) is
enabled.

Cc: David Brownell <dbrownell@...rs.sourceforge.net>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Ben Hutchings <ben@...adent.org.uk>
Cc: Joe Perches <joe@...ches.com>
Cc: Oliver Neukum <oliver@...kum.org>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>
Signed-off-by: Ming Lei <tom.leiming@...il.com>
Signed-off-by: David S. Miller <davem@...emloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@...e.de>
Signed-off-by: Andi Kleen <ak@...ux.intel.com>

---
 drivers/net/usb/usbnet.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

Index: linux/drivers/net/usb/usbnet.c
===================================================================
--- linux.orig/drivers/net/usb/usbnet.c
+++ linux/drivers/net/usb/usbnet.c
@@ -44,6 +44,7 @@
 #include <linux/usb.h>
 #include <linux/usb/usbnet.h>
 #include <linux/slab.h>
+#include <linux/pm_runtime.h>
 
 #define DRIVER_VERSION		"22-Aug-2005"
 
@@ -1272,6 +1273,16 @@ usbnet_probe (struct usb_interface *udev
 	struct usb_device		*xdev;
 	int				status;
 	const char			*name;
+	struct usb_driver 	*driver = to_usb_driver(udev->dev.driver);
+
+	/* usbnet already took usb runtime pm, so have to enable the feature
+	 * for usb interface, otherwise usb_autopm_get_interface may return
+	 * failure if USB_SUSPEND(RUNTIME_PM) is enabled.
+	 */
+	if (!driver->supports_autosuspend) {
+		driver->supports_autosuspend = 1;
+		pm_runtime_enable(&udev->dev);
+	}
 
 	name = udev->dev.driver->name;
 	info = (struct driver_info *) prod->driver_info;
--
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