Skip to contentSkip to conversation

Patch "usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared" has been added to the 4.1-stable tree

PATCH [email protected] 1 participant 1 message Sep 30, 2015

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared

to the 4.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usbnet-get-event_no_runtime_pm-bit-before-it-is-cleared.patch
and it can be found in the queue-4.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Wed Sep 30 05:18:31 CEST 2015

From: Eugene Shatokhin <[email protected]>
Date: Mon, 24 Aug 2015 23:13:42 +0300
Subject: usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared

From: Eugene Shatokhin <[email protected]>

[ Upstream commit f50791ac1aca1ac1b0370d62397b43e9f831421a ]

It is needed to check EVENT_NO_RUNTIME_PM bit of dev->flags in usbnet_stop(), but its value should be read before it is cleared when dev->flags is set to 0.

The problem was spotted and the fix was provided by Oliver Neukum <[email protected]>.

---
 drivers/net/usb/usbnet.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/usb/usbnet.c +4 -3
@@ -778,7 +778,7 @@ int usbnet_stop (struct net_device *net)
 {
 	struct usbnet		*dev = netdev_priv(net);
 	struct driver_info	*info = dev->driver_info;
-	int			retval, pm;
+	int			retval, pm, mpn;
 
 	clear_bit(EVENT_DEV_OPEN, &dev->flags);
 	netif_stop_queue (net);
@@ -809,6 +809,8 @@ int usbnet_stop (struct net_device *net)
 
 	usbnet_purge_paused_rxq(dev);
 
+	mpn = !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags);
+
 	/* deferred work (task, timer, softirq) must also stop.
 	 * can't flush_scheduled_work() until we drop rtnl (later),
 	 * else workers could deadlock; so make workers a NOP.
@@ -819,8 +821,7 @@ int usbnet_stop (struct net_device *net)
 	if (!pm)
 		usb_autopm_put_interface(dev->intf);
 
-	if (info->manage_power &&
-	    !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
+	if (info->manage_power && mpn)
 		info->manage_power(dev, 0);
 	else
 		usb_autopm_put_interface(dev->intf);

Patches currently in stable-queue which might be from [email protected] are

queue-4.1/usbnet-get-event_no_runtime_pm-bit-before-it-is-cleared.patch