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 CCC426FA0 for ; Mon, 16 Jan 2023 16:35:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A1B3C433EF; Mon, 16 Jan 2023 16:35:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1673886923; bh=a1zDYgg3OFV2ghETo/NBYZxc8BXe2XeaslW5LB49eQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmXYO8OWkCWrrV5BZJ2ETIJMtyW7judQ+mPIj6vNvcYm5qwTXDALhJV71EB2deYQU zFyMgvtrqIFaKMOr/jrV65Tf49NQshR5C660z03hIFXhgTtxgNJPyKFDUoTEJ3uxyQ c6E1AHgMB1AAyzTSW1HWSCEFCg9ToaQjn6nhei8Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Daniil Tatianin , Jiri Pirko , "David S. Miller" , Sasha Levin Subject: [PATCH 5.4 583/658] drivers/net/bonding/bond_3ad: return when theres no aggregator Date: Mon, 16 Jan 2023 16:51:11 +0100 Message-Id: <20230116154936.165530372@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230116154909.645460653@linuxfoundation.org> References: <20230116154909.645460653@linuxfoundation.org> User-Agent: quilt/0.67 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 From: Daniil Tatianin [ Upstream commit 9c807965483f42df1d053b7436eedd6cf28ece6f ] Otherwise we would dereference a NULL aggregator pointer when calling __set_agg_ports_ready on the line below. Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Daniil Tatianin Reviewed-by: Jiri Pirko Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/bonding/bond_3ad.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 0d6cd2a4cc41..0c4e6fcac58e 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -1529,6 +1529,7 @@ static void ad_port_selection_logic(struct port *port, bool *update_slave_arr) slave_err(bond->dev, port->slave->dev, "Port %d did not find a suitable aggregator\n", port->actor_port_number); + return; } } /* if all aggregator's ports are READY_N == TRUE, set ready=TRUE -- 2.35.1