[3.16.y-ckt stable] Patch "usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Mon Oct 26 21:14:59 UTC 2015


This is a note to let you know that I have just added a patch titled

    usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared

to the linux-3.16.y-queue branch of the 3.16.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-3.16.y-queue

This patch is scheduled to be released in version 3.19.8-ckt9.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.16.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From fe9291cd06f6b9fc1b8c1a43adc74392c7005e12 Mon Sep 17 00:00:00 2001
From: Eugene Shatokhin <eugene.shatokhin at rosalab.ru>
Date: Mon, 24 Aug 2015 23:13:42 +0300
Subject: usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared

commit f50791ac1aca1ac1b0370d62397b43e9f831421a upstream.

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 <oneukum at suse.de>.

Signed-off-by: Eugene Shatokhin <eugene.shatokhin at rosalab.ru>
Acked-by: Oliver Neukum <oneukum at suse.com>
Signed-off-by: David S. Miller <davem at davemloft.net>
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/net/usb/usbnet.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index e7ed251..7a59893 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -779,7 +779,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);
@@ -810,6 +810,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.
@@ -820,8 +822,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);
--
1.9.1





More information about the kernel-team mailing list