Patchwork [RFC,3/6] l2tp: drop session refs in l2tp_tunnel_closeall

login
register
mail settings
Submitter Tom Parkin
Date Feb. 15, 2013, 10:25 a.m.
Message ID <1360923919-7203-4-git-send-email-tparkin@katalix.com>
Download mbox | patch
Permalink /patch/220712/
State RFC
Delegated to: David Miller
Headers show

Comments

Tom Parkin - Feb. 15, 2013, 10:25 a.m.
l2tp_tunnel_closeall is intended to close and free all sessions running in a
given tunnel.  It lacked a session dereference, however, meaning these
sessions would all leak rather than being properly freed.

Add a session deref call in l2tp_tunnel_closeall to prevent this leak.

---
 net/l2tp/l2tp_core.c |    2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 3842f67..7f3ab65 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -1328,6 +1328,8 @@  again:
 			if (session->deref != NULL)
 				(*session->deref)(session);
 
+			l2tp_session_dec_refcount(session);
+
 			write_lock_bh(&tunnel->hlist_lock);
 
 			/* Now restart from the beginning of this hash