From patchwork Wed Jun 29 21:52:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16403 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 BED1582355; Wed, 29 Jun 2016 23:52:25 +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=PwBMCSBs; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2001:4d88:2000:7::2; 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 [IPv6:2001:4d88:2000:7::2]) by open-mesh.org (Postfix) with ESMTPS id 0EB978234F for ; Wed, 29 Jun 2016 23:52:24 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C113FD0000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c1:13fd::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 574B41C8001; Wed, 29 Jun 2016 23:52:24 +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=1467237144; bh=vihWOvYpBnBnm75y6rZAx6d0ZDHlMkBBlP0OgVBd6mA=; h=From:To:Cc:Subject:Date:From; b=PwBMCSBsBdvYiGBXpDb8SSXO+ky3P2QHgttXSCt8S4/iBxbLptFWGPYBS9uCy1dW0 IMe7rq+6mcR/X/hSu9Gaf0RoNwHLQpZGNqTAe/yKebU4gE96TFxS7wT2wh1i3r92Ex yYBU3MXAPZbeHM62sWkfH762T4KnwsQNpViwDxrA= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 29 Jun 2016 23:52:15 +0200 Message-Id: <1467237137-8418-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 Subject: [B.A.T.M.A.N.] [PATCH maint 1/3] batman-adv: Fix orig_node_vlan leak on orig_node_release 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" batadv_orig_node_new uses batadv_orig_node_vlan_new to allocate a new batadv_orig_node_vlan and add it to batadv_orig_node::vlan_list. References to this list have also to be cleaned when the batadv_orig_node is removed. Fixes: 21a57f6e7a3b ("batman-adv: make the TT CRC logic VLAN specific") Signed-off-by: Sven Eckelmann --- net/batman-adv/originator.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c index 7f51bc2..fe2fcda 100644 --- a/net/batman-adv/originator.c +++ b/net/batman-adv/originator.c @@ -765,6 +765,7 @@ static void batadv_orig_node_release(struct kref *ref) struct batadv_neigh_node *neigh_node; struct batadv_orig_node *orig_node; struct batadv_orig_ifinfo *orig_ifinfo; + struct batadv_orig_node_vlan *vlan; orig_node = container_of(ref, struct batadv_orig_node, refcount); @@ -784,6 +785,13 @@ static void batadv_orig_node_release(struct kref *ref) } spin_unlock_bh(&orig_node->neigh_list_lock); + 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); + batadv_orig_node_vlan_put(vlan); + } + spin_unlock_bh(&orig_node->vlan_list_lock); + /* Free nc_nodes */ batadv_nc_purge_orig(orig_node->bat_priv, orig_node, NULL);