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 8A3F179FD; Thu, 11 Apr 2024 10:49:41 +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=1712832581; cv=none; b=Y9CO66lp+TKTJYSvBGwNf8x3uZnBRJqGqkgfUyvsnx0CcqgVIaLU2U4P87spOduHeuwBmGK+Xa09ntACvfClqyZAUU3AfRATG4YfgHLcIlvt7h9Nze2IgTp607PrlKwid80AXY0KFFELoPfeOW4fbsGde3Tp0RGWx14FzADKvZ4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832581; c=relaxed/simple; bh=xVf2wXKslvdCRmJEd3K8TvhSvxBAi74R32KLXQD0jXQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pAhP5PXLB9AnDfcU5YjVg1WTb8RbIIrUhigjiLCenBm/kdBxIlqGxeinw/vzJQOb+eHofUcq/+6q32rBjSCFV6fCHzIF2ozUfo3sxz0s35WBy1xsXbShqN/m4RcMgK+gsXi8pfbM4350OHrNNLVtbuZ4MFHu5d4tR1lRb0qocys= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=MkiP4Jjc; 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="MkiP4Jjc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11142C433F1; Thu, 11 Apr 2024 10:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712832581; bh=xVf2wXKslvdCRmJEd3K8TvhSvxBAi74R32KLXQD0jXQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MkiP4JjcdcNETmSF46YE2MYF/5oVoEUjnq9gUF+KeWGQT0uErEb3rwAlPXdHwu/Lx g6meMy/39OOQTnAAnUapxMtN5xHkuriPyKynjel1DCr2NdprtYsEwsPwiW7QrIRuwW GKCIuLcxLucKvrkUkrczLed5oXCDRf7OsTtcAUaM= 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 5.15 03/57] batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() Date: Thu, 11 Apr 2024 11:57:11 +0200 Message-ID: <20240411095408.089112164@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095407.982258070@linuxfoundation.org> References: <20240411095407.982258070@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 5.15-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 42dcdf5fd76a1..c091b2a70d22d 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