From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Emil Tantilov <emil.s.tantilov@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 12/14] ixgbe: fix crash on rmmod after probe fail
Date: Fri, 5 Dec 2014 09:52:51 -0800 [thread overview]
Message-ID: <1417801973-28793-13-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1417801973-28793-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Emil Tantilov <emil.s.tantilov@intel.com>
The driver has logic to free up used data in case any of the checks in
ixgbe_probe() fail, however there is a similar set of cleanups that can
occur on driver unload in ixgbe_remove() which can cause the rmmod command
to crash.
This patch aims to fix the logic by moving pci_set_drvdata() after all error
checks and then adds a check in ixgbe_remove() to skip it altogether if
adapter comes up empty.
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 027c135..82d4187 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8206,7 +8206,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
SET_NETDEV_DEV(netdev, &pdev->dev);
adapter = netdev_priv(netdev);
- pci_set_drvdata(pdev, adapter);
adapter->netdev = netdev;
adapter->pdev = pdev;
@@ -8486,6 +8485,8 @@ skip_sriov:
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)
hw->mac.ops.disable_tx_laser(hw);
@@ -8565,9 +8566,14 @@ err_dma:
static void ixgbe_remove(struct pci_dev *pdev)
{
struct ixgbe_adapter *adapter = pci_get_drvdata(pdev);
- struct net_device *netdev = adapter->netdev;
+ struct net_device *netdev;
bool disable_dev;
+ /* if !adapter then we already cleaned up in probe */
+ if (!adapter)
+ return;
+
+ netdev = adapter->netdev;
ixgbe_dbg_adapter_exit(adapter);
set_bit(__IXGBE_REMOVING, &adapter->state);
--
1.9.3
next prev parent reply other threads:[~2014-12-05 17:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-05 17:52 [net-next 00/14][pull request] Intel Wired LAN Driver Updates 2014-12-05 Jeff Kirsher
2014-12-05 17:52 ` [net-next 01/14] ixgbe: Clean-up page reuse code Jeff Kirsher
2014-12-05 17:52 ` [net-next 02/14] ixgbe: Remove tail write abstraction and add missing barrier Jeff Kirsher
2014-12-05 17:52 ` [net-next 03/14] ixgbe: Look up MAC address in Open Firmware or IDPROM Jeff Kirsher
2014-12-05 17:52 ` [net-next 04/14] ixgbe: remove CIAA/D register reads from bad VF check Jeff Kirsher
2014-12-05 18:08 ` Alex Williamson
2014-12-06 4:49 ` David Miller
2014-12-06 4:58 ` Jeff Kirsher
2014-12-06 19:42 ` Alex Williamson
2014-12-05 17:52 ` [net-next 05/14] ixgbe: add support for X550 extended RSS support Jeff Kirsher
2014-12-05 17:52 ` [net-next 06/14] ixgbe: Add timeout parameter to ixgbe_host_interface_command Jeff Kirsher
2014-12-05 17:52 ` [net-next 07/14] ixgbe: Add x550 SW/FW semaphore support Jeff Kirsher
2014-12-05 17:52 ` [net-next 08/14] ixgbe: add methods for combined read and write operations Jeff Kirsher
2014-12-05 17:52 ` [net-next 09/14] ixgbe: cleanup checksum to allow error results Jeff Kirsher
2014-12-05 17:52 ` [net-next 10/14] ixgbe: Add X550 support function pointers Jeff Kirsher
2014-12-05 17:52 ` [net-next 11/14] ixgbe: bump version number Jeff Kirsher
2014-12-05 17:52 ` Jeff Kirsher [this message]
2014-12-05 17:52 ` [net-next 13/14] ixgbevf: add support for X550 VFs Jeff Kirsher
2014-12-05 17:52 ` [net-next 14/14] ixgbevf: fix possible crashes in probe and remove Jeff Kirsher
2014-12-06 4:55 ` [net-next 00/14][pull request] Intel Wired LAN Driver Updates 2014-12-05 David Miller
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=1417801973-28793-13-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=emil.s.tantilov@intel.com \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.com \
/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).