From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 631E81442F7; Thu, 11 Apr 2024 10:07:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830031; cv=none; b=ZDj47mq5A+sT+HGJRiv+jDU7NuMQhrOl1L4vOhtHtvFjqAbSRHVsX3TPdhkV07F7QOz/ukm2aED57DKdsxVDKG++pgXOIzHPrcJn45N5riLYjQ941n82wVRdTJA5PCN8nUOO14zJE3C2m0iAMSqG4JSIP/tZ8xELNj4YJFw/Pmk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712830031; c=relaxed/simple; bh=dVO74VJbn9TyKWysfBR9wbsxhqMszWMh8D7Rj+QSmjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rrhiv00j2bLa5QiqoAb0AdPtT+vhZbvUTx/mo2KHcTcqUMUs4f/5ewocB6EZ5GNOETp8galu5wq9RznVYm7P2oOJGUyAKS13nE/6JkoT/IQUFRAHMKaIUfs3pH6AAPY/9QPvUcRmQYImybWb0sfzGgvBJUykSQ4OsUchUO2z8DU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=2o5L+DPS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="2o5L+DPS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87732C433F1; Thu, 11 Apr 2024 10:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712830030; bh=dVO74VJbn9TyKWysfBR9wbsxhqMszWMh8D7Rj+QSmjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2o5L+DPSo4eKl5pryX3iGdNuLjRyWC292D0nGnZSilLLyAd48HUPxJ+z5NrkjtwDK qd5bioJjnUmcZIjuNRW7U5BX8UXj4syhFcc1x+2wbofoLRRhBc77/fU85RVnT+l6zE E0wIWTy+16/cCeKQmg5i1d9+XCGae1V032kPCzWE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Markus Elfring , Sven Eckelmann , Simon Wunderlich , Sasha Levin Subject: [PATCH 6.8 004/143] batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() Date: Thu, 11 Apr 2024 11:54:32 +0200 Message-ID: <20240411095421.040892795@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095420.903937140@linuxfoundation.org> References: <20240411095420.903937140@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.8-stable review patch. If anyone has any objections, please let me know. ------------------ From: Markus Elfring [ Upstream commit ffc15626c861f811f9778914be004fcf43810a91 ] 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 “out” which became unnecessary with this refactoring. Signed-off-by: Markus Elfring Acked-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Sasha Levin --- 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/distributed-arp-table.c index 28a939d560906..4c7e855343245 100644 --- 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 = 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; } -- 2.43.0