Patchwork vmxnet3: Fix race between dev_open() and register_netdev()

login
register
mail settings
Submitter Steve Hodgson
Date Aug. 14, 2012, 4:13 p.m.
Message ID <1344960816-12022-1-git-send-email-steve@purestorage.com>
Download mbox | patch
Permalink /patch/177354/
State Accepted
Delegated to: David Miller
Headers show

Comments

Steve Hodgson - Aug. 14, 2012, 4:13 p.m.
dev_open() can complete before register_netdev() returns.
Fix vmxnet3_probe_device() to support this.

Signed-off-by: Steve Hodgson <steve@purestorage.com>
---
 drivers/net/vmxnet3/vmxnet3_drv.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
David Miller - Aug. 15, 2012, 10:10 p.m.
From: Steve Hodgson <steve@purestorage.com>
Date: Tue, 14 Aug 2012 17:13:36 +0100

> dev_open() can complete before register_netdev() returns.
> Fix vmxnet3_probe_device() to support this.
> 
> Signed-off-by: Steve Hodgson <steve@purestorage.com>

Applied, thanks Steve.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 93e0cfb..ce9d4f2 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -3019,6 +3019,7 @@  vmxnet3_probe_device(struct pci_dev *pdev,
 	netdev->watchdog_timeo = 5 * HZ;
 
 	INIT_WORK(&adapter->work, vmxnet3_reset_work);
+	set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
 
 	if (adapter->intr.type == VMXNET3_IT_MSIX) {
 		int i;
@@ -3043,7 +3044,6 @@  vmxnet3_probe_device(struct pci_dev *pdev,
 		goto err_register;
 	}
 
-	set_bit(VMXNET3_STATE_BIT_QUIESCED, &adapter->state);
 	vmxnet3_check_link(adapter, false);
 	atomic_inc(&devices_found);
 	return 0;