Patch "net: fix __dev_kfree_skb_any() vs drop monitor" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: fix __dev_kfree_skb_any() vs drop monitor

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-fix-__dev_kfree_skb_any-vs-drop-monitor.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 3791f64ee4157e9bf3cd3d3d50545cd0408de8aa
Author: Eric Dumazet <edumazet@xxxxxxxxxx>
Date:   Thu Feb 23 08:38:45 2023 +0000

    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@xxxxxxxxxx>
    Cc: Yunsheng Lin <linyunsheng@xxxxxxxxxx>
    Reviewed-by: Yunsheng Lin <linyunsheng@xxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/core/dev.c b/net/core/dev.c
index 615cdaac3e729..1a4e20c4ba053 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);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux