Commit f943cbe6 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

inet: remove rcu protection on tw_net

commit b099ce26 (net: Batch inet_twsk_purge) added rcu protection
on tw_net for no obvious reason.

struct net are refcounted anyway since timewait sockets escape from rcu
protected sections. tw_net stay valid for the whole timwait lifetime.

This also removes a lot of sparse errors.
Signed-off-by: default avatarEric Dumazet <>
CC: Eric W. Biederman <>
Signed-off-by: default avatarDavid S. Miller <>
parent e6560d4d
......@@ -218,20 +218,12 @@ extern void inet_twsk_purge(struct inet_hashinfo *hashinfo,
static inline
struct net *twsk_net(const struct inet_timewait_sock *twsk)
return rcu_dereference_raw(twsk->tw_net); /* protected by locking, */
/* reference counting, */
/* initialization, or RCU. */
return &init_net;
return read_pnet(&twsk->tw_net);
static inline
void twsk_net_set(struct inet_timewait_sock *twsk, struct net *net)
rcu_assign_pointer(twsk->tw_net, net);
write_pnet(&twsk->tw_net, net);
#endif /* _INET_TIMEWAIT_SOCK_ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment