Patch "netfilter: egress: silence egress hook lockdep splats" has been added to the 5.16-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

    netfilter: egress: silence egress hook lockdep splats

to the 5.16-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:
     netfilter-egress-silence-egress-hook-lockdep-splats.patch
and it can be found in the queue-5.16 subdirectory.

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



commit b11353fe05c45221072ab82c7e43b875daacafab
Author: Florian Westphal <fw@xxxxxxxxx>
Date:   Mon Feb 28 04:18:05 2022 +0100

    netfilter: egress: silence egress hook lockdep splats
    
    [ Upstream commit 17a8f31bba7bac8cce4bd12bab50697da96e7710 ]
    
    Netfilter assumes its called with rcu_read_lock held, but in egress
    hook case it may be called with BH readlock.
    
    This triggers lockdep splat.
    
    In order to avoid to change all rcu_dereference() to
    rcu_dereference_check(..., rcu_read_lock_bh_held()), wrap nf_hook_slow
    with read lock/unlock pair.
    
    Reported-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
    Signed-off-by: Florian Westphal <fw@xxxxxxxxx>
    Signed-off-by: Pablo Neira Ayuso <pablo@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/include/linux/netfilter_netdev.h b/include/linux/netfilter_netdev.h
index b4dd96e4dc8d..e6487a691136 100644
--- a/include/linux/netfilter_netdev.h
+++ b/include/linux/netfilter_netdev.h
@@ -101,7 +101,11 @@ static inline struct sk_buff *nf_hook_egress(struct sk_buff *skb, int *rc,
 	nf_hook_state_init(&state, NF_NETDEV_EGRESS,
 			   NFPROTO_NETDEV, dev, NULL, NULL,
 			   dev_net(dev), NULL);
+
+	/* nf assumes rcu_read_lock, not just read_lock_bh */
+	rcu_read_lock();
 	ret = nf_hook_slow(skb, &state, e, 0);
+	rcu_read_unlock();
 
 	if (ret == 1) {
 		return skb;



[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