Skip to content

Commit bd112fd

Browse files
committed
netfilter: egress: silence egress hook lockdep splats
jira LE-1907 Rebuild_History Non-Buildable kernel-5.14.0-284.30.1.el9_2 commit-author Florian Westphal <fw@strlen.de> commit 17a8f31 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@gmail.com> Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> (cherry picked from commit 17a8f31) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 3a9ae06 commit bd112fd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/linux/netfilter_netdev.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,11 @@ static inline struct sk_buff *nf_hook_egress(struct sk_buff *skb, int *rc,
101101
nf_hook_state_init(&state, NF_NETDEV_EGRESS,
102102
NFPROTO_NETDEV, NULL, dev, NULL,
103103
dev_net(dev), NULL);
104+
105+
/* nf assumes rcu_read_lock, not just read_lock_bh */
106+
rcu_read_lock();
104107
ret = nf_hook_slow(skb, &state, e, 0);
108+
rcu_read_unlock();
105109

106110
if (ret == 1) {
107111
return skb;

0 commit comments

Comments
 (0)