drivers: net: xgene: fix possible use after free
authorEric Dumazet <[email protected]>
Wed, 25 Nov 2015 17:02:10 +0000 (09:02 -0800)
committerDavid S. Miller <[email protected]>
Mon, 30 Nov 2015 03:51:45 +0000 (22:51 -0500)
Once TX has been enabled on a NIC, it is illegal to access skb,
as this skb might have been freed by another cpu, from TX completion
handler.

Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Mark Rutland <[email protected]>
Tested-by: Mark Rutland <[email protected]>
Cc: Iyappan Subramanian <[email protected]>
Acked-by: Iyappan Subramanian <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/ethernet/apm/xgene/xgene_enet_main.c

index 1adfe70368435ece3167b51cecd9e9e476f092b4..9147a0107c44034f015beba83cfc150398c1ac93 100644 (file)
@@ -450,12 +450,12 @@ static netdev_tx_t xgene_enet_start_xmit(struct sk_buff *skb,
                return NETDEV_TX_OK;
        }
 
-       pdata->ring_ops->wr_cmd(tx_ring, count);
        skb_tx_timestamp(skb);
 
        pdata->stats.tx_packets++;
        pdata->stats.tx_bytes += skb->len;
 
+       pdata->ring_ops->wr_cmd(tx_ring, count);
        return NETDEV_TX_OK;
 }