netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matt Mackall <mpm@selenic.com>
To: Dave Miller <davem@davemloft.net>,
	netdev@oss.sgi.com, Patrick McHardy <kaber@trash.net>
Subject: [PATCH] netpoll fix racy dev->flags usage
Date: Thu, 10 Mar 2005 15:22:46 -0800	[thread overview]
Message-ID: <20050310232245.GR3120@waste.org> (raw)

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

Signed-off-by: Matt Mackall <mpm@selenic.com>

Index: np/net/core/netpoll.c
===================================================================
--- np.orig/net/core/netpoll.c	2005-03-10 17:02:03.000000000 -0600
+++ np/net/core/netpoll.c	2005-03-10 17:12:46.000000000 -0600
@@ -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();

-- 
Mathematics is the supreme nostalgia of our time.

             reply	other threads:[~2005-03-10 23:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-10 23:22 Matt Mackall [this message]
2005-03-23  2:40 ` [PATCH] netpoll fix racy dev->flags usage David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050310232245.GR3120@waste.org \
    --to=mpm@selenic.com \
    --cc=davem@davemloft.net \
    --cc=kaber@trash.net \
    --cc=netdev@oss.sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).