inetpeer: fix a race in inetpeer_gc_worker()
commit 5faa5df1fa
(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>
This commit is contained in:

committed by
David S. Miller

parent
dd03cff23d
commit
55432d2b54
@@ -40,7 +40,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
|
||||
|
Reference in New Issue
Block a user