Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=c49a1561ee4b663d2819b5bea3e4684eae217b19
Commit:     c49a1561ee4b663d2819b5bea3e4684eae217b19
Parent:     24fcad6b3ca3bdbbb4614de3edc1ff16f594ba9a
Author:     Michael Chan <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 17 17:07:29 2006 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Sun Dec 17 21:59:20 2006 -0800

    [TG3]: Fix race condition when calling register_netdev().
    
    Hot-plug scripts can call tg3_open() as soon as register_netdev() is
    called in tg3_init_one().  We need to call pci_set_drvdata() before
    register_netdev(), and netif_carrier_off() needs to be moved to
    tg3_open() to avoid race conditions.
    
    Signed-off-by: Michael Chan <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 drivers/net/tg3.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index e47a9c1..501ea6d 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -6981,6 +6981,8 @@ static int tg3_open(struct net_device *dev)
        struct tg3 *tp = netdev_priv(dev);
        int err;
 
+       netif_carrier_off(tp->dev);
+
        tg3_full_lock(tp, 0);
 
        err = tg3_set_power_state(tp, PCI_D0);
@@ -11920,6 +11922,8 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
         */
        pci_save_state(tp->pdev);
 
+       pci_set_drvdata(pdev, dev);
+
        err = register_netdev(dev);
        if (err) {
                printk(KERN_ERR PFX "Cannot register net device, "
@@ -11927,8 +11931,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
                goto err_out_iounmap;
        }
 
-       pci_set_drvdata(pdev, dev);
-
        printk(KERN_INFO "%s: Tigon3 [partno(%s) rev %04x PHY(%s)] (%s) %s 
Ethernet ",
               dev->name,
               tp->board_part_number,
@@ -11959,8 +11961,6 @@ static int __devinit tg3_init_one(struct pci_dev *pdev,
               (pdev->dma_mask == DMA_32BIT_MASK) ? 32 :
                (((u64) pdev->dma_mask == DMA_40BIT_MASK) ? 40 : 64));
 
-       netif_carrier_off(tp->dev);
-
        return 0;
 
 err_out_iounmap:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to