ibmvnic: Fix cleanup of SKB's on driver close
authorThomas Falcon <tlfalcon@linux.vnet.ibm.com>
Fri, 26 May 2017 14:30:31 +0000 (10:30 -0400)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 May 2017 19:32:45 +0000 (15:32 -0400)
A race condition occurs when closing the driver. Free'ing of skb's
can race between the close routine and ibmvnic_tx_interrupt. To fix
this we move the claenup of tx pools during close to after the
sub-CRQ interrupts are disabled.

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

index 465a8fafd95bf353c0b2f0910708e46bcf2042de..0f705e68755fbc917a44d8ff253044ecf0690142 100644 (file)
@@ -804,7 +804,6 @@ static int __ibmvnic_close(struct net_device *netdev)
        adapter->state = VNIC_CLOSING;
        netif_tx_stop_all_queues(netdev);
        ibmvnic_napi_disable(adapter);
-       clean_tx_pools(adapter);
 
        if (adapter->tx_scrq) {
                for (i = 0; i < adapter->req_tx_queues; i++)
@@ -833,6 +832,7 @@ static int __ibmvnic_close(struct net_device *netdev)
                }
        }
 
+       clean_tx_pools(adapter);
        adapter->state = VNIC_CLOSED;
        return rc;
 }