]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ixgbe: fix incorrect map used in eee linkmode
authorAlok Tiwari <alok.a.tiwari@oracle.com>
Sun, 10 Aug 2025 17:01:14 +0000 (10:01 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 9 Sep 2025 16:58:09 +0000 (18:58 +0200)
[ Upstream commit b7e5c3e3bfa9dc8af75ff6d8633ad7070e1985e4 ]

incorrectly used ixgbe_lp_map in loops intended to populate the
supported and advertised EEE linkmode bitmaps based on ixgbe_ls_map.
This results in incorrect bit setting and potential out-of-bounds
access, since ixgbe_lp_map and ixgbe_ls_map have different sizes
and purposes.

ixgbe_lp_map[i] -> ixgbe_ls_map[i]

Use ixgbe_ls_map for supported and advertised linkmodes, and keep
ixgbe_lp_map usage only for link partner (lp_advertised) mapping.

Fixes: 9356b6db9d05 ("net: ethernet: ixgbe: Convert EEE to use linkmodes")
Signed-off-by: Alok Tiwari <alok.a.tiwari@oracle.com>
Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Tested-by: Rinitha S <sx.rinitha@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c

index 9482e0cca8b7d27beb16e84c6fea333d43ea8417..0b9ecb10aa7cf9dbca259b7af4c96d4a11f40882 100644 (file)
@@ -3443,13 +3443,13 @@ ixgbe_get_eee_fw(struct ixgbe_adapter *adapter, struct ethtool_keee *edata)
 
        for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) {
                if (hw->phy.eee_speeds_supported & ixgbe_ls_map[i].mac_speed)
-                       linkmode_set_bit(ixgbe_lp_map[i].link_mode,
+                       linkmode_set_bit(ixgbe_ls_map[i].link_mode,
                                         edata->supported);
        }
 
        for (i = 0; i < ARRAY_SIZE(ixgbe_ls_map); ++i) {
                if (hw->phy.eee_speeds_advertised & ixgbe_ls_map[i].mac_speed)
-                       linkmode_set_bit(ixgbe_lp_map[i].link_mode,
+                       linkmode_set_bit(ixgbe_ls_map[i].link_mode,
                                         edata->advertised);
        }