Skip to content

Commit

Permalink
ixgbe: pci_set_drvdata must be called before register_netdev
Browse files Browse the repository at this point in the history
We call pci_set_drvdata immediately after calling register_netdev,
which leaves a window where tasks writing to the sriov_numvfs sysfs
attribute can sneak in and crash the kernel.  register_netdev cleans
up after itself so placing pci_set_drvdata immediately before it
should preserve the intent of commit 0fb6a55 ("ixgbe: fix crash
on rmmod after probe fail").

Fixes: 0fb6a55 ("ixgbe: fix crash on rmmod after probe fail")
Signed-off-by: Jeff Mahoney <[email protected]>
Tested-by: Andrew Bowers <[email protected]>
Signed-off-by: Jeff Kirsher <[email protected]>
  • Loading branch information
jeffmahoney authored and Jeff Kirsher committed Jun 14, 2017
1 parent 4ebdf8a commit a09c0fc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10372,11 +10372,11 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
"hardware.\n");
}
strcpy(netdev->name, "eth%d");
pci_set_drvdata(pdev, adapter);
err = register_netdev(netdev);
if (err)
goto err_register;

pci_set_drvdata(pdev, adapter);

/* power down the optics for 82599 SFP+ fiber */
if (hw->mac.ops.disable_tx_laser)
Expand Down

0 comments on commit a09c0fc

Please sign in to comment.