ixgbe: Fix possible null-dereference in error path
authorMark Rustad <mark.d.rustad@intel.com>
Fri, 6 Jun 2014 01:57:00 +0000 (01:57 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Thu, 24 Jul 2014 08:02:48 +0000 (01:02 -0700)
In ixgbe_probe, the code at label err_dma can dereference adapter
when it has a NULL value. The check is there to avoid disabling a
disabled device. When adapter is NULL, treat it as if the device
is enabled, because it is enabled in that case.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

index f5aa3311ea286bbd45d56933ad015e33f48d69fb..16e8e444c616cd4a312b5a19319446f6e1359482 100644 (file)
@@ -8477,7 +8477,7 @@ err_alloc_etherdev:
                                     pci_select_bars(pdev, IORESOURCE_MEM));
 err_pci_reg:
 err_dma:
-       if (!test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
+       if (!adapter || !test_and_set_bit(__IXGBE_DISABLED, &adapter->state))
                pci_disable_device(pdev);
        return err;
 }