Skip to content

Commit

Permalink
net: suppress RCU lockdep false positive in twsk_net()
Browse files Browse the repository at this point in the history
Calls to twsk_net() are in some cases protected by reference counting
as an alternative to RCU protection.  Cases covered by reference counts
include __inet_twsk_kill(), inet_twsk_free(), inet_twdr_do_twkill_work(),
inet_twdr_twcal_tick(), and tcp_timewait_state_process().  RCU is used
by inet_twsk_purge().  Locking is used by established_get_first()
and established_get_next().  Finally, __inet_twsk_hashdance() is an
initialization case.

It appears to be non-trivial to locate the appropriate locks and
reference counts from within twsk_net(), so used rcu_dereference_raw().

Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
paulmck authored and davem330 committed Apr 27, 2010
1 parent d4c4f07 commit 7ec75c5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion include/net/inet_timewait_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ static inline
struct net *twsk_net(const struct inet_timewait_sock *twsk)
{
#ifdef CONFIG_NET_NS
return rcu_dereference(twsk->tw_net);
return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
/* reference counting, */
/* initialization, or RCU. */
#else
return &init_net;
#endif
Expand Down

0 comments on commit 7ec75c5

Please sign in to comment.