ibmveth_reset() runs from a work item queued by the RX, poll and
replenish paths. It calls dev_close() and dev_open() without checking
whether the device is still up. If the admin sets the device down
between queueing the work and the work taking rtnl_lock(), dev_close()
does nothing and dev_open() brings the device back up.

Only close and reopen the device if it is running.

Fixes: 2c91e2319ed9 ("net: ibmveth: Reset the adapter when unexpected states 
are detected")
Signed-off-by: Mingming Cao <[email protected]>
---
 drivers/net/ethernet/ibm/ibmveth.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmveth.c 
b/drivers/net/ethernet/ibm/ibmveth.c
index faacff14841b..34745df8daaa 100644
--- a/drivers/net/ethernet/ibm/ibmveth.c
+++ b/drivers/net/ethernet/ibm/ibmveth.c
@@ -904,8 +904,10 @@ static void ibmveth_reset(struct work_struct *w)
 
        rtnl_lock();
 
-       dev_close(adapter->netdev);
-       dev_open(adapter->netdev, NULL);
+       if (netif_running(netdev)) {
+               dev_close(netdev);
+               dev_open(netdev, NULL);
+       }
 
        rtnl_unlock();
 
-- 
2.50.1 (Apple Git-155)


Reply via email to