Skip to contentSkip to conversation

netpoll fix racy dev->flags usage

PATCH Applied Matt Mackall 2 participants 2 messages Mar 10, 2005 – Mar 23, 2005

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 netpoll fix racy dev->flags usage

Put ndev->flags usage under the lock. Spotted by Patrick McHardy.

net/core/netpoll.c +1 -4
Index: np/net/core/netpoll.c
===================================================================
@@ -632,16 +632,13 @@ int netpoll_setup(struct netpoll *np)
 	}
 
 	if (!netif_running(ndev)) {
-		unsigned short oflags;
 		unsigned long atmost, atleast;
 
 		printk(KERN_INFO "%s: device %s not up yet, forcing it\n",
 		       np->name, np->dev_name);
 
-		oflags = ndev->flags;
-
 		rtnl_shlock();
-		if (dev_change_flags(ndev, oflags | IFF_UP) < 0) {
+		if (dev_change_flags(ndev, ndev->flags | IFF_UP) < 0) {
 			printk(KERN_ERR "%s: failed to open %s\n",
 			       np->name, np->dev_name);
 			rtnl_shunlock();
Signature · 1 line
Mathematics is the supreme nostalgia of our time.