net: l2tp_eth: fix l2tp_eth_dev_xmit race
authorEric Dumazet <edumazet@google.com>
Mon, 25 Jun 2012 00:45:14 +0000 (00:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Mon, 25 Jun 2012 23:30:54 +0000 (16:30 -0700)
Its illegal to dereference skb after giving it to l2tp_xmit_skb()
as it might be already freed/reused.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/l2tp/l2tp_eth.c

index 185f12f4a5fa21a90bbce5641b7d751722d8c9ca..c3738f49646ae4ae33c14541c0d9880752d399b6 100644 (file)
@@ -88,12 +88,12 @@ static int l2tp_eth_dev_xmit(struct sk_buff *skb, struct net_device *dev)
        struct l2tp_eth *priv = netdev_priv(dev);
        struct l2tp_session *session = priv->session;
 
-       l2tp_xmit_skb(session, skb, session->hdr_len);
-
        dev->stats.tx_bytes += skb->len;
        dev->stats.tx_packets++;
 
-       return 0;
+       l2tp_xmit_skb(session, skb, session->hdr_len);
+
+       return NETDEV_TX_OK;
 }
 
 static struct net_device_ops l2tp_eth_netdev_ops = {