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

net: fix __dev_kfree_skb_any() vs drop monitor

dev_kfree_skb() is aliased to consume_skb().

When a driver is dropping a packet by calling dev_kfree_skb_any()
we should propagate the drop reason instead of pretending
the packet was consumed.

Note: Now we have enum skb_drop_reason we could remove
enum skb_free_reason (for linux-6.4)

v2: added an unlikely(), suggested by Yunsheng Lin.

Fixes: e6247027 ("net: introduce dev_consume_skb_any()")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1862de92
......@@ -3134,8 +3134,10 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason)
{
if (in_hardirq() || irqs_disabled())
__dev_kfree_skb_irq(skb, reason);
else if (unlikely(reason == SKB_REASON_DROPPED))
kfree_skb(skb);
else
dev_kfree_skb(skb);
consume_skb(skb);
}
EXPORT_SYMBOL(__dev_kfree_skb_any);
......
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