From patchwork Thu Jun 30 19:41:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16411 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id E058B821E4; Thu, 30 Jun 2016 21:41:23 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=lly0Bk0b; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 8F855821D9 for ; Thu, 30 Jun 2016 21:41:21 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C14EF90000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c1:4ef9::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 003B51100E8; Thu, 30 Jun 2016 21:41:20 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1467315681; bh=5ELXc5ouFsSniHA4kcW0sdYjjB7oMtEadiU3jglFZCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lly0Bk0bZrkwV5tXUwAI1fNHKaQlAiy9s+fvGU7Pj4Id0LPZimwFUuPqPpFbOxEm7 rDc7E3c3t5tDPYwkA9xU2HHEmyI+T+N04XC6v4VDOwvxrUSZPjLovvjr7tjnhiI0Ig KYDXWDi1W4DCL7WbozCIlcCwWg2Gd4pI0+sbI2RA= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 30 Jun 2016 21:41:13 +0200 Message-Id: <1467315673-9950-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1467310246-5820-1-git-send-email-sven@narfation.org> References: <1467310246-5820-1-git-send-email-sven@narfation.org> Subject: [B.A.T.M.A.N.] [PATCH maint v2 4/4] batman-adv: Free last_bonding_candidate on release of orig_node X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The orig_ifinfo reference counter for last_bonding_candidate in batadv_orig_node has to be reduced when an originator node is released. Otherwise the orig_ifinfo is leaked and the reference counter the netdevice is not reduced correctly. Fixes: 797edd9e87ac ("batman-adv: add bonding again") Signed-off-by: Sven Eckelmann --- v2: - added new patch --- net/batman-adv/originator.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 40626b4..8208276 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -787,6 +787,7 @@ static void batadv_orig_node_release(struct kref *ref) struct batadv_orig_node *orig_node; struct batadv_orig_ifinfo *orig_ifinfo; struct batadv_orig_node_vlan *vlan; + struct batadv_orig_ifinfo *last_candidate; orig_node = container_of(ref, struct batadv_orig_node, refcount); @@ -804,8 +805,14 @@ static void batadv_orig_node_release(struct kref *ref) hlist_del_rcu(&orig_ifinfo->list); batadv_orig_ifinfo_put(orig_ifinfo); } + + last_candidate = orig_node->last_bonding_candidate; + orig_node->last_bonding_candidate = NULL; spin_unlock_bh(&orig_node->neigh_list_lock); + if (last_candidate) + batadv_orig_ifinfo_put(last_candidate); + spin_lock_bh(&orig_node->vlan_list_lock); hlist_for_each_entry_safe(vlan, node_tmp, &orig_node->vlan_list, list) { hlist_del_rcu(&vlan->list);