From patchwork Fri Feb 15 10:25:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Parkin X-Patchwork-Id: 220712 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id DD7472C0089 for ; Fri, 15 Feb 2013 21:25:50 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161250Ab3BOKZj (ORCPT ); Fri, 15 Feb 2013 05:25:39 -0500 Received: from katalix.com ([82.103.140.233]:34090 "EHLO mail.katalix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161230Ab3BOKZg (ORCPT ); Fri, 15 Feb 2013 05:25:36 -0500 Received: from raven.tomandflo.local (cpc28-brad20-2-0-cust174.17-1.cable.virginmedia.com [77.97.157.175]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: tom) by mail.katalix.com (Postfix) with ESMTPSA id B9FE4A62126; Fri, 15 Feb 2013 10:25:34 +0000 (GMT) From: Tom Parkin To: netdev@vger.kernel.org Cc: jchapman@katalix.com, celston@katalix.com, Tom Parkin Subject: [RFC PATCH 3/6] l2tp: drop session refs in l2tp_tunnel_closeall Date: Fri, 15 Feb 2013 10:25:16 +0000 Message-Id: <1360923919-7203-4-git-send-email-tparkin@katalix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1360923919-7203-1-git-send-email-tparkin@katalix.com> References: <1360923919-7203-1-git-send-email-tparkin@katalix.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org 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