Commit 6ec82562 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

veth: Dont kfree_skb() after dev_forward_skb()

In case of congestion, netif_rx() frees the skb, so we must assume
dev_forward_skb() also consume skb.

Bug introduced by commit 44540960
(veth: move loopback logic to common location)

We must change dev_forward_skb() to always consume skb, and veth to not
double free it.

Bug report : http://marc.info/?l=linux-netdev&m=127310770900442&w=3Reported-by: default avatarMartín Ferrari <martin.ferrari@gmail.com>
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d40a4de0
...@@ -187,7 +187,6 @@ tx_drop: ...@@ -187,7 +187,6 @@ tx_drop:
return NETDEV_TX_OK; return NETDEV_TX_OK;
rx_drop: rx_drop:
kfree_skb(skb);
rcv_stats->rx_dropped++; rcv_stats->rx_dropped++;
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
......
...@@ -1451,7 +1451,7 @@ static inline void net_timestamp(struct sk_buff *skb) ...@@ -1451,7 +1451,7 @@ static inline void net_timestamp(struct sk_buff *skb)
* *
* return values: * return values:
* NET_RX_SUCCESS (no congestion) * NET_RX_SUCCESS (no congestion)
* NET_RX_DROP (packet was dropped) * NET_RX_DROP (packet was dropped, but freed)
* *
* dev_forward_skb can be used for injecting an skb from the * dev_forward_skb can be used for injecting an skb from the
* start_xmit function of one device into the receive queue * start_xmit function of one device into the receive queue
...@@ -1465,12 +1465,11 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) ...@@ -1465,12 +1465,11 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
{ {
skb_orphan(skb); skb_orphan(skb);
if (!(dev->flags & IFF_UP)) if (!(dev->flags & IFF_UP) ||
return NET_RX_DROP; (skb->len > (dev->mtu + dev->hard_header_len))) {
kfree_skb(skb);
if (skb->len > (dev->mtu + dev->hard_header_len))
return NET_RX_DROP; return NET_RX_DROP;
}
skb_set_dev(skb, dev); skb_set_dev(skb, dev);
skb->tstamp.tv64 = 0; skb->tstamp.tv64 = 0;
skb->pkt_type = PACKET_HOST; skb->pkt_type = PACKET_HOST;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment