From patchwork Wed Nov 29 09:50:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 17165 X-Patchwork-Delegate: sven@narfation.org 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 CCEAC80671; Wed, 29 Nov 2017 10:50:57 +0100 (CET) Authentication-Results: open-mesh.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=openmesh-com.20150623.gappssmtp.com header.i=@openmesh-com.20150623.gappssmtp.com header.b="QVH4MKwl"; dkim-atps=neutral Received-SPF: None (mailfrom) identity=mailfrom; client-ip=2607:f8b0:400d:c0d::241; helo=mail-qt0-x241.google.com; envelope-from=sven.eckelmann@openmesh.com; receiver= Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) by open-mesh.org (Postfix) with ESMTPS id DF988800E8 for ; Wed, 29 Nov 2017 10:50:54 +0100 (CET) Received: by mail-qt0-x241.google.com with SMTP id d4so3530611qtj.5 for ; Wed, 29 Nov 2017 01:50:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openmesh-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=CxhtqFMDf4qZN9ho+nGJeOAN7IJWXNrZglA6B+Pdqs4=; b=QVH4MKwlcAnFQCcWg+GPt01A1e6XKB0ona9178ts6K6j3qyM3Qi4nH2WD1BJWhGZeb HUEKDvE4SALp2Vuw+A5RPq0Fr0MpILBese2IOP/hsRVdK7muqfu6G+XuAhSDVHmevIgt nJgpVVhKGCI8qvXnLFTdNZfCpAqj/2I4KRvGqaCcfiLS4hebMroDQB02xy27vxdnumND raR84jM23NIFt89LYNoprux2XRyNBt2qQRrSusthfSkz6qKOUt8qzslwOPVIuSK0vqGT Ejd6uDlLQns5k7LEdTuDnatUqOivKP1DsKXKANU03SQOF/gwW5L1wzCQkBxgoIzAdLSb uCmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CxhtqFMDf4qZN9ho+nGJeOAN7IJWXNrZglA6B+Pdqs4=; b=FzVRp7FkWA1KveSKqC824HCbV5MK39jkUqPtacIJu+qtSKx71cxVDeie1H+1Ig3/Uy IZVjywvzRGCn6Jsn+ZGA+WC/IZt8NZLwD0kQkec3ewJHS0qijM1CmW9DW1yXmk9W0Y28 hGY3DXAg5nmJah6y5/u5MT+U/JlIH4Iv0ql5lICpFurruNWSyJADkGgVhyjH52/IMa+0 GJkvggB3pS5GgWDR5XXZ88CYrHGlB8JvaHWXaB5rng5j+0RA3mwlYwtMK/okFYk/a31i +gh52KdqxfStp4Ss+BvMBZEca+10p6DPvQmfUqNDy5CAqlAC5/ASChGeQUVTTjED/gRG LI3g== X-Gm-Message-State: AJaThX6VTmIcs4Cp8vowlvAsycaiXbEweDLAX51TT60ISgyXcsTbfnVx XHE40or35TGy7CghVK9NNAAq518X X-Google-Smtp-Source: AGs4zMaE8hvV7O57PE8Qbj26ZglCoXX9e5uglkePYpKvyLBAkZSZDb+nkAUhEuTOVP+y/wJxaav21g== X-Received: by 10.237.55.202 with SMTP id j68mr3246383qtb.93.1511949053744; Wed, 29 Nov 2017 01:50:53 -0800 (PST) Received: from sven-desktop.home.narfation.org (p549BDDB2.dip0.t-ipconnect.de. [84.155.221.178]) by smtp.gmail.com with ESMTPSA id 3sm927824qty.47.2017.11.29.01.50.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 29 Nov 2017 01:50:53 -0800 (PST) From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 29 Nov 2017 10:50:42 +0100 Message-Id: <20171129095042.12587-1-sven.eckelmann@openmesh.com> X-Mailer: git-send-email 2.11.0 Subject: [B.A.T.M.A.N.] [PATCH] batman-adv: Fix check of retrieved orig_gw in batadv_v_gw_is_eligible X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.23 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 Cc: Antonio Quartulli , Sven Eckelmann Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "B.A.T.M.A.N" The batadv_v_gw_is_eligible function already assumes that orig_node is not NULL. But batadv_gw_node_get may have failed to find the originator. It must therefore be checked whether the batadv_gw_node_get failed and not whether orig_node is NULL to detect this error. Fixes: 80b2d47be2c7 ("batman-adv: B.A.T.M.A.N. V - implement GW selection logic") Signed-off-by: Sven Eckelmann Acked-by: Antonio Quartulli --- Cc: Antonio Quartulli --- net/batman-adv/bat_v.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/bat_v.c b/net/batman-adv/bat_v.c index 341ceab8338d829d14a48831bef805bb04af0a8f..e0e2bfcd6b3efd73f2567d23ce304951c9e2c3f0 100644 --- a/net/batman-adv/bat_v.c +++ b/net/batman-adv/bat_v.c @@ -814,7 +814,7 @@ static bool batadv_v_gw_is_eligible(struct batadv_priv *bat_priv, } orig_gw = batadv_gw_node_get(bat_priv, orig_node); - if (!orig_node) + if (!orig_gw) goto out; if (batadv_v_gw_throughput_get(orig_gw, &orig_throughput) < 0)