diff options
author | Eric Dumazet <edumazet@google.com> | 2012-06-05 03:00:18 +0000 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2013-10-26 21:05:57 +0100 |
commit | 8f9b44910e7456fd898fe5da1f45e2d463cbfb31 (patch) | |
tree | 1f5c6f191fb849bbd75091b4bb5ba03df4af0f39 /include | |
parent | c25e82c03fed5bf21418963cebc92de7797f9b3b (diff) |
inetpeer: fix a race in inetpeer_gc_worker()
[ Upstream commit 55432d2b543a4b6dfae54f5c432a566877a85d90 ]
commit 5faa5df1fa2024 (inetpeer: Invalidate the inetpeer tree along with
the routing cache) added a race :
Before freeing an inetpeer, we must respect a RCU grace period, and make
sure no user will attempt to increase refcnt.
inetpeer_invalidate_tree() waits for a RCU grace period before inserting
inetpeer tree into gc_list and waking the worker. At that time, no
concurrent lookup can find a inetpeer in this tree.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'include')
-rw-r--r-- | include/net/inetpeer.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h index ac8a4ea2c76..34b06dadca0 100644 --- a/include/net/inetpeer.h +++ b/include/net/inetpeer.h @@ -41,7 +41,10 @@ struct inet_peer { u32 pmtu_orig; u32 pmtu_learned; struct inetpeer_addr_base redirect_learned; - struct list_head gc_list; + union { + struct list_head gc_list; + struct rcu_head gc_rcu; + }; /* * Once inet_peer is queued for deletion (refcnt == -1), following fields * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp |