Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

l2tp: avoid to use synchronize_rcu in tunnel free function

Avoid to use synchronize_rcu in l2tp_tunnel_free because context may be
atomic.

Signed-off-by: Dmitry Kozlov <xeb@mail.ru>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

xeb@mail.ru and committed by
David S. Miller
99469c32 e2c53be2

+2 -2
+1 -2
net/l2tp/l2tp_core.c
··· 1347 1347 /* Remove from tunnel list */ 1348 1348 spin_lock_bh(&pn->l2tp_tunnel_list_lock); 1349 1349 list_del_rcu(&tunnel->list); 1350 + kfree_rcu(tunnel, rcu); 1350 1351 spin_unlock_bh(&pn->l2tp_tunnel_list_lock); 1351 - synchronize_rcu(); 1352 1352 1353 1353 atomic_dec(&l2tp_tunnel_count); 1354 - kfree(tunnel); 1355 1354 } 1356 1355 1357 1356 /* Create a socket for the tunnel, if one isn't set up by
+1
net/l2tp/l2tp_core.h
··· 163 163 164 164 struct l2tp_tunnel { 165 165 int magic; /* Should be L2TP_TUNNEL_MAGIC */ 166 + struct rcu_head rcu; 166 167 rwlock_t hlist_lock; /* protect session_hlist */ 167 168 struct hlist_head session_hlist[L2TP_HASH_SIZE]; 168 169 /* hashed list of sessions,