diff options
| author | Eric Dumazet <edumazet@google.com> | 2023-02-23 08:38:45 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-03-11 16:44:11 +0100 |
| commit | edfba7b3228a95f602e4dce6b6cb20810081862c (patch) | |
| tree | d5cc7aae289a88bb757a47bac3ff50961a59cebf | |
| parent | cec326443f01283ef68ea00c06ea073b1835a562 (diff) | |
| download | linux-edfba7b3228a95f602e4dce6b6cb20810081862c.tar.gz linux-edfba7b3228a95f602e4dce6b6cb20810081862c.tar.bz2 linux-edfba7b3228a95f602e4dce6b6cb20810081862c.zip | |
net: fix __dev_kfree_skb_any() vs drop monitor
[ Upstream commit ac3ad19584b26fae9ac86e4faebe790becc74491 ]
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: e6247027e517 ("net: introduce dev_consume_skb_any()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Yunsheng Lin <linyunsheng@huawei.com>
Reviewed-by: Yunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | net/core/dev.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 615cdaac3e72..1a4e20c4ba05 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2735,8 +2735,10 @@ void __dev_kfree_skb_any(struct sk_buff *skb, enum skb_free_reason reason) { if (in_irq() || 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); |
