ibmvnic: Flush existing work items before device removal
authorThomas Falcon <tlfalcon@linux.ibm.com>
Fri, 12 Jun 2020 18:34:41 +0000 (13:34 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 12 Jun 2020 21:11:02 +0000 (14:11 -0700)
Ensure that all scheduled work items have completed before continuing
with device removal and after further event scheduling has been
halted. This patch fixes a bug where a scheduled driver reset event
is processed following device removal.

Signed-off-by: Thomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/ibm/ibmvnic.c

index 197dc5b2c0905d26110f747efa0b3071d6457e18..1b4d04e4474bb5fbf466aa1abfd0bab640f2bb7e 100644 (file)
@@ -5184,6 +5184,9 @@ static int ibmvnic_remove(struct vio_dev *dev)
        adapter->state = VNIC_REMOVING;
        spin_unlock_irqrestore(&adapter->state_lock, flags);
 
+       flush_work(&adapter->ibmvnic_reset);
+       flush_delayed_work(&adapter->ibmvnic_delayed_reset);
+
        rtnl_lock();
        unregister_netdevice(netdev);