[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZxdoY8Uehc3qs89P@shredder.mtl.com>
Date: Tue, 22 Oct 2024 11:54:59 +0300
From: Ido Schimmel <idosch@...dia.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, dsahern@...nel.org, horms@...nel.org,
pshelar@...ira.com
Subject: Re: [PATCH net] ipv4: ip_tunnel: Fix suspicious RCU usage warning in
ip_tunnel_find()
On Tue, Oct 22, 2024 at 09:26:11AM +0200, Eric Dumazet wrote:
> I was looking at this recently, and my thinking is the following :
>
> 1) ASSERT_RTNL() is adding code even on non debug kernels.
>
> 2) It does not check if the current thread is owning the RTNL mutex,
> only that _some_ thread is owning it.
>
> I would think that using lockdep_rtnl_is_held() would be better ?
Yes, agree. I see I did the same thing in 7f6f32bb7d335. Will post v2
tomorrow unless you prefer to submit it yourself (I don't mind).
Thanks
>
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index d591c73e2c0e53efefb8fb9262610cbbd1dd71ea..25505f9b724c33d2c3ec2fca5355d7fdd4e01c14
> 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -218,7 +218,7 @@ static struct ip_tunnel *ip_tunnel_find(struct
> ip_tunnel_net *itn,
>
> ip_tunnel_flags_copy(flags, parms->i_flags);
>
> - hlist_for_each_entry_rcu(t, head, hash_node) {
> + hlist_for_each_entry_rcu(t, head, hash_node, lockdep_rtnl_is_held()) {
> if (local == t->parms.iph.saddr &&
> remote == t->parms.iph.daddr &&
> link == READ_ONCE(t->parms.link) &&
Powered by blists - more mailing lists