Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a09c0fc3 authored by Jeff Mahoney's avatar Jeff Mahoney Committed by Jeff Kirsher
Browse files

ixgbe: pci_set_drvdata must be called before register_netdev



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 0fb6a55c ("ixgbe: fix crash
on rmmod after probe fail").

Fixes: 0fb6a55c ("ixgbe: fix crash on rmmod after probe fail")
Signed-off-by: default avatarJeff Mahoney <jeffm@suse.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 4ebdf8af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)