Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6390460rdb; Mon, 1 Jan 2024 23:12:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRIoZ2MGVMGIlBhtvJPM4FMcRaIRy0UNCLJdnN1m9aLQGLUEPQSixEyhyV3XF07uRKB03w X-Received: by 2002:a05:6808:169f:b0:3bb:d451:338f with SMTP id bb31-20020a056808169f00b003bbd451338fmr6055525oib.57.1704179538909; Mon, 01 Jan 2024 23:12:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704179538; cv=none; d=google.com; s=arc-20160816; b=CGwwvyU+3OnidCFERDSy7A/7XvTc8v07wAmO+KgaLmKYBnB3idyMP5Sy0liyMZCdT9 NqggWyCBy7P+jie5MWTCtUsK2xbChifxQOZyANnDzWFm2Gw017RNpH1IHHKSdiHb1nUb ast45H0kbWv3wCMGN0A29hmWUwa/Nvq+Gc6hwcFcn3W789Hz9bLRV1yOLMi+RsLyGqGW tiGnC3K0o6n+UxnhuuOeLD1AFmc8lG+Tz+fw/DG5jXUJUFJKteN7CmGZ/Biz0Asrqi80 G3fLURPvxKcVoJuS5Wq05oy49/nBn8EwXXpDdtMY6X0gJkUSprFViwyLKg31M7S2gM/O ws4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=sHHLFqfSv1YoPOHcZyNuMp1h6OmcT6ojrsDhPQ8Sb5s=; fh=OeEHk+ifQ82u7aYU++AncCznSo8hxldpl7lXAUdxJNA=; b=0vC3OyninV2aBy1mNHHu+zp46p31zmafrQ3qhJS3Pnfoh1Z8enIXRpmTodykRq0/nT g2ibEl+E+nFsulYu/szqN3ykyv8yVPe2b+P0GPAnrytAgh+EvObc5hKQUPBolez/5rxs Yoou7LlddQl5k2DwCh2HLJmloJ11kFmXZnEJwdQiCRd2MpyrWAqtcHDK8Sd2/oUwqSFB N8EujYYDVVeXnRpr1sXWwOR8iSix4zEUHO6h9ve8duAHNlNF7Hd8VX1EWXLwwxANDMAp gJOgmIoUk72XIZT0ue/8YeNBjxXFkvAeMd2+DY4UGf0KT9C+oPwN/JKixLMmxQ3MxDP0 Qk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=Y8f7sCRQ; spf=pass (google.com: domain of linux-kernel+bounces-14108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id p4-20020a0c8c84000000b00680684164a6si11919894qvb.304.2024.01.01.23.12.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jan 2024 23:12:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@web.de header.s=s29768273 header.b=Y8f7sCRQ; spf=pass (google.com: domain of linux-kernel+bounces-14108-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14108-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=web.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 928101C214AD for ; Tue, 2 Jan 2024 07:12:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2AD51211A; Tue, 2 Jan 2024 07:12:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="Y8f7sCRQ" X-Original-To: linux-kernel@vger.kernel.org Received: from mout.web.de (mout.web.de [212.227.15.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47A2120F5; Tue, 2 Jan 2024 07:12:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1704179508; x=1704784308; i=markus.elfring@web.de; bh=V53RxSn45Of6qQKpHmIQL7d5i6Uj4RYbOSBA1Ek79pU=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=Y8f7sCRQHnrSUdosDFxS7ot/bgBH4fRzW+edTj2Ya0s4eJKETS06OuQFjf7aYoY5 RwVHcX4dIh7xJRUb9cGo3OgGqV46IPVQfixd2PYq/N52LTPytLbyeewmy/tmEBBfs Hy0PYVJm+9jKzkOy2cKbLgrpBiWRsOgcNLJDGNi5YYqpS3l7coJRx8M91eoWp8CmY 1Nt69XT7zF147mUKcgzg0qSotRbO7shjJ3R2NNwUk155W1DNDQvshJ4ftuxtlpQLJ t65y1QjpiaNln8eIwa5dOVWA1v142PPfzzPOf/q1NVq9UBsM5ptZWMU2P5knZ1dBk FP1FGDaxcMdSTmirzA== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.91.95]) by smtp.web.de (mrweb006 [213.165.67.108]) with ESMTPSA (Nemesis) id 1Mt8gP-1r4pPG3DJJ-00t5Ck; Tue, 02 Jan 2024 08:11:47 +0100 Message-ID: <54dc53f8-5f08-4f1d-938a-c845c8ec0d44@web.de> Date: Tue, 2 Jan 2024 08:11:47 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/2] batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() Content-Language: en-GB From: Markus Elfring To: b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Antonio Quartulli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Marek Lindner , Paolo Abeni , Simon Wunderlich , Sven Eckelmann Cc: LKML References: <8588cafe-3c61-40a6-b071-0877632a2a1e@web.de> In-Reply-To: <8588cafe-3c61-40a6-b071-0877632a2a1e@web.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:Aa/rztWe/OKkxjpDmxNoqQjPyzaHKv8xKPJ8QBGSYir2aUs9wDc hAx5dt+2EqvulF6HrKiKtryVzbaltQ3ZrIogjp1ELjbso1QJMUZ6EjRpYtjHBUYbATrGe5e E0y8IJ0zU9v56pDAb3zvFfiJp0gmJ6B5ZU4w+4iWUez1RO9OaHOKoNcLjA8i0HBzqJfYE2T sJX/sMP4LrFkGxdZpK6Eg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:7mrs2rexnTs=;nQXkY8Kc5fVXWDIu+nDG+pagpaJ 1wDztkHmrGcwFFlSV2v0MG24Bi9GNBh9mlg91AOZ59UEeM+AlMF0mKHG2cjNwX3Tt/U/OeQb8 vHHTFSLrVMh1DerU3CnmJ/3pQqcZkKJEaZyhnK5nRzRhJrfw37HP9PUJ8jprDAxWZb2bny1ZF B6L8LkmXGIEaOE2JO9xwNnubZq9xFVNyqeKDybT3gNaUJZNpiQqCwf53fuGXnUoXlxmHb9ipP ONwVWKMccpIi0Ug/PlUSiSVRsOM/pnKEbTqiZOQtVsLou0PySCkC1RMqLpXb2zXNkO0u13X0P wYrYWffNGr31GDYUxxsSzkfHywWy1aYrf4oXbnF5OuS6Z1wC0zvXbEoB0YGsyuCTtiYVZxxqW U7Owm6MYRYUrgQkfrDGLvDtbU31sLM7F+qMnUDN7o4DQbonULYDiFjQ/qlyKueAfHdcC9nkFV XbgmgC5YpDcyFGGm9sjBnc2oKrZAyf/DCqJ5Img6bWZxdXusdD3iRrYfO7oCbcAIJBEZ9CdJK ecyjERhAIeVwcrd4l8wzgqm1aq9qiRUz16/KKWAm060P1eBh0DEQ7D8DnXp+6iqyPHKKF2ISA esNU4/gjIG/FrfmGqLeikkr995V2mxavAYZrwoROp8NurE/YinQUjQuj1vdcTs62unLREa5uf xIlvn2prnccrwkyolxXi0bJEx7NBPir6BLrihcjr1RoWypNb73HXBen3uQOgw8nDDXJ0tX6Xa NfIIUQyIGncHXDzjEElrDRa3OAtvJtb8j8Da69Fe+EpatZUzVZijfOE+4RsUNJi4Bt/q5SthS fFxd9pQDze4uq1MJ7hTR8hMttH4XNzMbB4mCMJHJcwLH2cSBWVEa2eeQw8y4/03IUGo8hSKGB jasLYy632feg672vjfXxU1WuFKmLW3b2HftvYP1OpmtlOvf5sE9argmp9L7W1shC137gYaGK2 8XvEww== From: Markus Elfring Date: Tue, 2 Jan 2024 07:27:45 +0100 The kfree() function was called in one case by the batadv_dat_forward_data() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. * Thus return directly after a batadv_dat_select_candidates() call failed at the beginning. * Delete the label =E2=80=9Cout=E2=80=9D which became unnecessary with thi= s refactoring. Signed-off-by: Markus Elfring =2D-- net/batman-adv/distributed-arp-table.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distr= ibuted-arp-table.c index 28a939d56090..4c7e85534324 100644 =2D-- a/net/batman-adv/distributed-arp-table.c +++ b/net/batman-adv/distributed-arp-table.c @@ -684,7 +684,7 @@ static bool batadv_dat_forward_data(struct batadv_priv= *bat_priv, cand =3D batadv_dat_select_candidates(bat_priv, ip, vid); if (!cand) - goto out; + return ret; batadv_dbg(BATADV_DBG_DAT, bat_priv, "DHT_SEND for %pI4\n", &ip); @@ -728,7 +728,6 @@ static bool batadv_dat_forward_data(struct batadv_priv= *bat_priv, batadv_orig_node_put(cand[i].orig_node); } -out: kfree(cand); return ret; } =2D- 2.43.0