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 DDCE66BB29; Thu, 11 Apr 2024 10:46:23 +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=1712832384; cv=none; b=UQZa274iQUqkR1BS1QqudVThknxUT0H2Tgukscg0evt6vPx22aS498EjIsrvSji0Z8GcwuL2S9oDxCp6OrxjA/asaHARfEW55/2lsG5rpfI6ckrnhO7zh8dIvrOP9yc3T/L5oIX0m3KMurml1hbWueTwHIqQLKdEMYitZob7toM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712832384; c=relaxed/simple; bh=iLgPLm1FcwiKZJppAmWV/rmx0FnXLILqIDXLsugToAo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b1O8ajWFw7Vj/zfPLAW44AHfFkWTmxxUyVPI8/IO0jNxpp0ZYAliRgBWGpF//rtuSX6QDb7fC+BIDrQd8U/+HssPiwQRWLCCBRLP+sn3k0mYtonwdYdm6UxA5CK0P2yWIFtL2wNe+X/FsKGruWHkVOAZMqKENka8iY6L9AhEYnU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T+3P5eC2; 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="T+3P5eC2" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62D7CC433F1; Thu, 11 Apr 2024 10:46:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1712832383; bh=iLgPLm1FcwiKZJppAmWV/rmx0FnXLILqIDXLsugToAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T+3P5eC2q2j4azkW4JkH3MLexeEEKUTYMlXRWtsu5i3POfvahC+Ju1Y+OnLsVAMQ+ QTHwxwywRPHEZMnQ8VBcM1C93daSS++OnFghi0MBjp+SSvNdUVPIyZpw/T1YJEtrEh E3RWJhcD+glCcW9J/GoW4PRuOgfmdrko3w5G9HYM= 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.1 03/83] batman-adv: Return directly after a failed batadv_dat_select_candidates() in batadv_dat_forward_data() Date: Thu, 11 Apr 2024 11:56:35 +0200 Message-ID: <20240411095412.778699955@linuxfoundation.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240411095412.671665933@linuxfoundation.org> References: <20240411095412.671665933@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.1-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 a0233252032dc..521d4952eb515 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