Commit a1f6c6b1 authored by xunleer's avatar xunleer Committed by Jeff Kirsher

ixgbevf: don't release the soft entries

When the ixgbevf driver is opened the request to allocate MSIX irq
vectors may fail.  In that case the driver will call ixgbevf_down()
which will call ixgbevf_irq_disable() to clear the HW interrupt
registers and calls synchronize_irq() using the msix_entries pointer in
the adapter structure.  However, when the function to request the MSIX
irq vectors failed it had already freed the msix_entries which causes
an OOPs from using the NULL pointer in synchronize_irq().

The calls to pci_disable_msix() and to free the msix_entries memory
should not occur if device open fails.  Instead they should be called
during device driver removal to balance with the call to
pci_enable_msix() and the call to allocate msix_entries memory
during the device probe and driver load.
Signed-off-by: default avatarLi Xun <xunleer.li@huawei.com>
Signed-off-by: default avatarGreg Rose <gregory.v.rose@intel.com>
Tested-by: default avatarSibai Li <sibai.li@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent a79ca223
...@@ -944,9 +944,17 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter) ...@@ -944,9 +944,17 @@ static int ixgbevf_request_msix_irqs(struct ixgbevf_adapter *adapter)
free_irq(adapter->msix_entries[vector].vector, free_irq(adapter->msix_entries[vector].vector,
adapter->q_vector[vector]); adapter->q_vector[vector]);
} }
pci_disable_msix(adapter->pdev); /* This failure is non-recoverable - it indicates the system is
kfree(adapter->msix_entries); * out of MSIX vector resources and the VF driver cannot run
adapter->msix_entries = NULL; * without them. Set the number of msix vectors to zero
* indicating that not enough can be allocated. The error
* will be returned to the user indicating device open failed.
* Any further attempts to force the driver to open will also
* fail. The only way to recover is to unload the driver and
* reload it again. If the system has recovered some MSIX
* vectors then it may succeed.
*/
adapter->num_msix_vectors = 0;
return err; return err;
} }
...@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2572,6 +2580,15 @@ static int ixgbevf_open(struct net_device *netdev)
struct ixgbe_hw *hw = &adapter->hw; struct ixgbe_hw *hw = &adapter->hw;
int err; int err;
/* A previous failure to open the device because of a lack of
* available MSIX vector resources may have reset the number
* of msix vectors variable to zero. The only way to recover
* is to unload/reload the driver and hope that the system has
* been able to recover some MSIX vector resources.
*/
if (!adapter->num_msix_vectors)
return -ENOMEM;
/* disallow open during test */ /* disallow open during test */
if (test_bit(__IXGBEVF_TESTING, &adapter->state)) if (test_bit(__IXGBEVF_TESTING, &adapter->state))
return -EBUSY; return -EBUSY;
...@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev) ...@@ -2628,7 +2645,6 @@ static int ixgbevf_open(struct net_device *netdev)
err_req_irq: err_req_irq:
ixgbevf_down(adapter); ixgbevf_down(adapter);
ixgbevf_free_irq(adapter);
err_setup_rx: err_setup_rx:
ixgbevf_free_all_rx_resources(adapter); ixgbevf_free_all_rx_resources(adapter);
err_setup_tx: err_setup_tx:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment