From patchwork Sat May 7 07:03: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: 16103 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 D85D982239; Sat, 7 May 2016 09:03:22 +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=wiDWc6Xy; 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 1A20581CCA for ; Sat, 7 May 2016 09:03:20 +0200 (CEST) Received: from sven-edge.localnet (p200300C593C6A8FD0000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c6:a8fd::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 468B411000C for ; Sat, 7 May 2016 09:03: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=1462604600; bh=JJw1k0Jr4pT4pAhYAvzNQzc+JoHC+1auVv/laWJh+dc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=wiDWc6Xy3O+ON9mw7+ZGiLxwDKVjdFL2FN6R5k5ZnMVw4nAur+AbI1mbRj15aVHO2 Rg+BnTqauxB+RHHIexBbokIJrNg7iortgteOdWosgL8PM3v0ftYbrwJn/DbNyje18r a0MD5fyoM2dpr6LZQ3iKOVhX32MSI+E+t2fBZdn8= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 07 May 2016 09:03:13 +0200 Message-ID: <1656407.PytZZyZNAi@sven-edge> User-Agent: KMail/4.14.10 (Linux/4.5.0-2-amd64; KDE/4.14.14; x86_64; ; ) In-Reply-To: <1462566429-26709-1-git-send-email-sven@narfation.org> References: <1462566429-26709-1-git-send-email-sven@narfation.org> MIME-Version: 1.0 Subject: Re: [B.A.T.M.A.N.] [PATCH maint] batman-adv: Fix double neigh_node_put in batadv_v_ogm_route_update 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" On Friday 06 May 2016 22:27:09 Sven Eckelmann wrote: > The router is put down twice when it was non-NULL and either orig_ifinfo is > NULL afterwards or batman-adv receives a packet with the same sequence > number. This will end up in a use-after-free when the batadv_neigh_node is > removed because the reference counter ended up too early at 0. > > Fixes: 667996ebeab4 ("batman-adv: OGMv2 - implement originators logic") > Signed-off-by: Sven Eckelmann [...] There is a conflict with master. I hope that Antonio can share how it can be resolved when he submits following remaining fixes to David: * batman-adv: Fix integer overflow in batadv_iv_ogm_calc_tq * batman-adv: Avoid duplicate neigh_node additions * batman-adv: make sure ELP/OGM orig MAC is updated on address change * batman-adv: Fix unexpected free of bcast_own on add_if error * batman-adv: Avoid nullptr derefence in batadv_v_neigh_is_sob * batman-adv: Fix refcnt leak in batadv_v_neigh_* * batman-adv: Fix double neigh_node_put in batadv_v_ogm_route_update The solution for the merge conflict with master is: --- a/net/batman-adv/bat_v_ogm.c +++ b/net/batman-adv/bat_v_ogm.c @@ -510,17 +510,10 @@ goto out; } -<<<<<<< /* Mark the OGM to be considered for forwarding, and update routes * if needed. */ forward = true; -======= - if (router) { - batadv_neigh_node_put(router); - router = NULL; - } ->>>>>>> batadv_dbg(BATADV_DBG_BATMAN, bat_priv, "Searching and updating originator entry of received packet\n");