netfilter: egress: silence egress hook lockdep splats
authorFlorian Westphal <fw@strlen.de>
Mon, 28 Feb 2022 03:18:05 +0000 (04:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 19 Mar 2022 12:48:44 +0000 (13:48 +0100)
commit7ddd4196c86a3b7112b0fcf9a33c61f975946edb
tree0cb21a4d649fb3a42c820a4f8ec171eb56c82694
parentb1cbbe4104af01f0afa542d0ca99cd324e05f633
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@gmail.com>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/netfilter_netdev.h