diff options
author | Li RongQing <roy.qing.li@gmail.com> | 2014-10-16 08:49:41 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-14 08:59:42 -0800 |
commit | 4fe1c409e0067a635653aa227ac3696d6c22c802 (patch) | |
tree | 428ef561cd1efffad089ea96d5be673893d3504f /drivers/net/vxlan.c | |
parent | 78083feea991885270e92eef4bfaf212fc8df35e (diff) | |
download | linux-stable-4fe1c409e0067a635653aa227ac3696d6c22c802.tar.gz linux-stable-4fe1c409e0067a635653aa227ac3696d6c22c802.tar.bz2 linux-stable-4fe1c409e0067a635653aa227ac3696d6c22c802.zip |
vxlan: fix a use after free in vxlan_encap_bypass
[ Upstream commit ce6502a8f9572179f044a4d62667c4645256d6e4 ]
when netif_rx() is done, the netif_rx handled skb maybe be freed,
and should not be used.
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r-- | drivers/net/vxlan.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c index 9b40532041cb..3e35bc6d23a6 100644 --- a/drivers/net/vxlan.c +++ b/drivers/net/vxlan.c @@ -1770,6 +1770,8 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, struct pcpu_sw_netstats *tx_stats, *rx_stats; union vxlan_addr loopback; union vxlan_addr *remote_ip = &dst_vxlan->default_dst.remote_ip; + struct net_device *dev = skb->dev; + int len = skb->len; tx_stats = this_cpu_ptr(src_vxlan->dev->tstats); rx_stats = this_cpu_ptr(dst_vxlan->dev->tstats); @@ -1793,16 +1795,16 @@ static void vxlan_encap_bypass(struct sk_buff *skb, struct vxlan_dev *src_vxlan, u64_stats_update_begin(&tx_stats->syncp); tx_stats->tx_packets++; - tx_stats->tx_bytes += skb->len; + tx_stats->tx_bytes += len; u64_stats_update_end(&tx_stats->syncp); if (netif_rx(skb) == NET_RX_SUCCESS) { u64_stats_update_begin(&rx_stats->syncp); rx_stats->rx_packets++; - rx_stats->rx_bytes += skb->len; + rx_stats->rx_bytes += len; u64_stats_update_end(&rx_stats->syncp); } else { - skb->dev->stats.rx_dropped++; + dev->stats.rx_dropped++; } } |