Patch "lan966x: Fix crash when adding interface under a lag" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    lan966x: Fix crash when adding interface under a lag

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     lan966x-fix-crash-when-adding-interface-under-a-lag.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit fec09cbc0db8092724257979dd2e5cd5e81bc64e
Author: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
Date:   Tue Feb 6 13:30:54 2024 +0100

    lan966x: Fix crash when adding interface under a lag
    
    [ Upstream commit 15faa1f67ab405d47789d4702f587ec7df7ef03e ]
    
    There is a crash when adding one of the lan966x interfaces under a lag
    interface. The issue can be reproduced like this:
    ip link add name bond0 type bond miimon 100 mode balance-xor
    ip link set dev eth0 master bond0
    
    The reason is because when adding a interface under the lag it would go
    through all the ports and try to figure out which other ports are under
    that lag interface. And the issue is that lan966x can have ports that are
    NULL pointer as they are not probed. So then iterating over these ports
    it would just crash as they are NULL pointers.
    The fix consists in actually checking for NULL pointers before accessing
    something from the ports. Like we do in other places.
    
    Fixes: cabc9d49333d ("net: lan966x: Add lag support for lan966x")
    Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
    Reviewed-by: Michal Swiatkowski <michal.swiatkowski@xxxxxxxxxxxxxxx>
    Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240206123054.3052966-1-horatiu.vultur@xxxxxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c b/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
index 41fa2523d91d..5f2cd9a8cf8f 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_lag.c
@@ -37,19 +37,24 @@ static void lan966x_lag_set_aggr_pgids(struct lan966x *lan966x)
 
 	/* Now, set PGIDs for each active LAG */
 	for (lag = 0; lag < lan966x->num_phys_ports; ++lag) {
-		struct net_device *bond = lan966x->ports[lag]->bond;
+		struct lan966x_port *port = lan966x->ports[lag];
 		int num_active_ports = 0;
+		struct net_device *bond;
 		unsigned long bond_mask;
 		u8 aggr_idx[16];
 
-		if (!bond || (visited & BIT(lag)))
+		if (!port || !port->bond || (visited & BIT(lag)))
 			continue;
 
+		bond = port->bond;
 		bond_mask = lan966x_lag_get_mask(lan966x, bond);
 
 		for_each_set_bit(p, &bond_mask, lan966x->num_phys_ports) {
 			struct lan966x_port *port = lan966x->ports[p];
 
+			if (!port)
+				continue;
+
 			lan_wr(ANA_PGID_PGID_SET(bond_mask),
 			       lan966x, ANA_PGID(p));
 			if (port->lag_tx_active)




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux