drivers/net/bonding/bond_3ad: return when there's no aggregator
authorDaniil Tatianin <d-tatianin@yandex-team.ru>
Mon, 2 Jan 2023 09:53:35 +0000 (12:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:02:28 +0000 (12:02 +0100)
[ 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 <d-tatianin@yandex-team.ru>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/bonding/bond_3ad.c

index e58a1e0..9270977 100644 (file)
@@ -1540,6 +1540,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