netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: netdev@vger.kernel.org, Andrew Morton <akpm@osdl.org>,
	jgarzik@pobox.com, Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] r8169: fix a race between PCI probe and dev_open
Date: Wed, 31 Jan 2007 22:34:28 +0100	[thread overview]
Message-ID: <20070131213428.GA17534@electric-eye.fr.zoreil.com> (raw)

Call chain:
-> rtl8169_init_one
   -> register_netdev                  (dev_open starts to race...)
   -> rtl8169_init_phy
      -> rtl8169_set_speed
         -> tp->set_speed
         -> mod_timer(&tp->timer, ...) (if netif_running() is true)

As netif_running() is true just before dev->open() is issued and the
timer is initialized during dev->open, mod_timer() meets an uninitialized
tp->timer and oopses.

rtl8169_init_phy is only used on rtl8169_init_one so it's fine to never
ask it to activate the timer: the racing dev->open will do it anyway.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Bernhard Walle <bwalle@suse.de>
---
 drivers/net/r8169.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 577babd..3fc0611 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -1448,7 +1448,7 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
 
 	rtl8169_phy_reset(dev, tp);
 
-	rtl8169_set_speed(dev, autoneg, speed, duplex);
+	tp->set_speed(dev, autoneg, speed, duplex);
 
 	if ((RTL_R8(PHYstatus) & TBI_Enable) && netif_msg_link(tp))
 		printk(KERN_INFO PFX "%s: TBI auto-negotiating\n", dev->name);
-- 
1.4.4.4


             reply	other threads:[~2007-01-31 21:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-31 21:34 Francois Romieu [this message]
2007-02-01  0:55 ` [PATCH] r8169: fix a race between PCI probe and dev_open Linus Torvalds
2007-02-01  8:17   ` Francois Romieu
2007-02-01 13:04   ` Jeff Garzik
2007-02-01  2:40 ` Herbert Xu
2007-02-01  8:28   ` Francois Romieu

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=20070131213428.GA17534@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=akpm@osdl.org \
    --cc=bwalle@suse.de \
    --cc=jgarzik@pobox.com \
    --cc=netdev@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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).