aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-06-04 23:00:18 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-06 13:45:15 -0400
commit55432d2b543a4b6dfae54f5c432a566877a85d90 (patch)
treef830eb5150e38be149fcfce74f68716f5bf2641a /include
parentdd03cff23d694cfb0fdae80cb618e7ced05ea696 (diff)
inetpeer: fix a race in inetpeer_gc_worker()
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>
Diffstat (limited to 'include')
-rw-r--r--include/net/inetpeer.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h
index b94765e38e80..2040bff945d4 100644
--- a/include/net/inetpeer.h
+++ b/include/net/inetpeer.h
@@ -40,7 +40,10 @@ struct inet_peer {
40 u32 pmtu_orig; 40 u32 pmtu_orig;
41 u32 pmtu_learned; 41 u32 pmtu_learned;
42 struct inetpeer_addr_base redirect_learned; 42 struct inetpeer_addr_base redirect_learned;
43 struct list_head gc_list; 43 union {
44 struct list_head gc_list;
45 struct rcu_head gc_rcu;
46 };
44 /* 47 /*
45 * Once inet_peer is queued for deletion (refcnt == -1), following fields 48 * Once inet_peer is queued for deletion (refcnt == -1), following fields
46 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp 49 * are not available: rid, ip_id_count, tcp_ts, tcp_ts_stamp