aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Shatokhin <eugene.shatokhin@rosalab.ru>2015-08-24 16:13:42 -0400
committerDavid S. Miller <davem@davemloft.net>2015-08-25 22:44:13 -0400
commitf50791ac1aca1ac1b0370d62397b43e9f831421a (patch)
tree5abf5300a97557eec74051c5043b24468a51a8cd
parentccc02ddb1bb7c0c1cac695db18f7533296b51ecc (diff)
usbnet: Get EVENT_NO_RUNTIME_PM bit before it is cleared
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@suse.de>. Signed-off-by: Eugene Shatokhin <eugene.shatokhin@rosalab.ru> Acked-by: Oliver Neukum <oneukum@suse.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/usb/usbnet.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c
index 3c86b107275a..e0498571ae26 100644
--- a/drivers/net/usb/usbnet.c
+++ b/drivers/net/usb/usbnet.c
@@ -778,7 +778,7 @@ int usbnet_stop (struct net_device *net)
778{ 778{
779 struct usbnet *dev = netdev_priv(net); 779 struct usbnet *dev = netdev_priv(net);
780 struct driver_info *info = dev->driver_info; 780 struct driver_info *info = dev->driver_info;
781 int retval, pm; 781 int retval, pm, mpn;
782 782
783 clear_bit(EVENT_DEV_OPEN, &dev->flags); 783 clear_bit(EVENT_DEV_OPEN, &dev->flags);
784 netif_stop_queue (net); 784 netif_stop_queue (net);
@@ -809,6 +809,8 @@ int usbnet_stop (struct net_device *net)
809 809
810 usbnet_purge_paused_rxq(dev); 810 usbnet_purge_paused_rxq(dev);
811 811
812 mpn = !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags);
813
812 /* deferred work (task, timer, softirq) must also stop. 814 /* deferred work (task, timer, softirq) must also stop.
813 * can't flush_scheduled_work() until we drop rtnl (later), 815 * can't flush_scheduled_work() until we drop rtnl (later),
814 * else workers could deadlock; so make workers a NOP. 816 * else workers could deadlock; so make workers a NOP.
@@ -819,8 +821,7 @@ int usbnet_stop (struct net_device *net)
819 if (!pm) 821 if (!pm)
820 usb_autopm_put_interface(dev->intf); 822 usb_autopm_put_interface(dev->intf);
821 823
822 if (info->manage_power && 824 if (info->manage_power && mpn)
823 !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags))
824 info->manage_power(dev, 0); 825 info->manage_power(dev, 0);
825 else 826 else
826 usb_autopm_put_interface(dev->intf); 827 usb_autopm_put_interface(dev->intf);