From patchwork Fri Feb 15 10:25:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [RFC,3/6] l2tp: drop session refs in l2tp_tunnel_closeall Date: Fri, 15 Feb 2013 00:25:16 -0000 From: Tom Parkin X-Patchwork-Id: 220712 Message-Id: <1360923919-7203-4-git-send-email-tparkin@katalix.com> To: netdev@vger.kernel.org Cc: jchapman@katalix.com, celston@katalix.com, Tom Parkin 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(+) 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