netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH nf-next] netfilter: egress: avoid a lockdep splat
@ 2022-01-07 14:46 Florian Westphal
  2022-01-09 22:33 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2022-01-07 14:46 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Florian Westphal

include/linux/netfilter_netdev.h:97 suspicious rcu_dereference_check() usage!
2 locks held by sd-resolve/1100:
 0: ..(rcu_read_lock_bh){1:3}, at: ip_finish_output2
 1: ..(rcu_read_lock_bh){1:3}, at: __dev_queue_xmit
 __dev_queue_xmit+0 ..

The helper has two callers, one uses rcu_read_lock, the other
rcu_read_lock_bh().  Annotate the dereference to reflect this.

Fixes: 42df6e1d221dd ("netfilter: Introduce egress hook")
Signed-off-by: Florian Westphal <fw@strlen.de>
---
 targetting -next since its only a wrong annotation.

 include/linux/netfilter_netdev.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/netfilter_netdev.h b/include/linux/netfilter_netdev.h
index b71b57a83bb4..b4dd96e4dc8d 100644
--- a/include/linux/netfilter_netdev.h
+++ b/include/linux/netfilter_netdev.h
@@ -94,7 +94,7 @@ static inline struct sk_buff *nf_hook_egress(struct sk_buff *skb, int *rc,
 		return skb;
 #endif
 
-	e = rcu_dereference(dev->nf_hooks_egress);
+	e = rcu_dereference_check(dev->nf_hooks_egress, rcu_read_lock_bh_held());
 	if (!e)
 		return skb;
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH nf-next] netfilter: egress: avoid a lockdep splat
  2022-01-07 14:46 [PATCH nf-next] netfilter: egress: avoid a lockdep splat Florian Westphal
@ 2022-01-09 22:33 ` Pablo Neira Ayuso
  0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2022-01-09 22:33 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel

On Fri, Jan 07, 2022 at 03:46:16PM +0100, Florian Westphal wrote:
> include/linux/netfilter_netdev.h:97 suspicious rcu_dereference_check() usage!
> 2 locks held by sd-resolve/1100:
>  0: ..(rcu_read_lock_bh){1:3}, at: ip_finish_output2
>  1: ..(rcu_read_lock_bh){1:3}, at: __dev_queue_xmit
>  __dev_queue_xmit+0 ..
> 
> The helper has two callers, one uses rcu_read_lock, the other
> rcu_read_lock_bh().  Annotate the dereference to reflect this.

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-09 22:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-07 14:46 [PATCH nf-next] netfilter: egress: avoid a lockdep splat Florian Westphal
2022-01-09 22:33 ` Pablo Neira Ayuso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).