Skip to content

Commit 344f7a4

Browse files
hkallweitkuba-moo
authored andcommitted
ethtool: ignore unused/unreliable fields in set_eee op
This function is used with the set_eee() ethtool operation. Certain fields of struct ethtool_keee() are relevant only for the get_eee() operation. In addition, in case of the ioctl interface, we have no guarantee that userspace sends sane values in struct ethtool_eee. Therefore explicitly ignore all fields not needed for set_eee(). This protects from drivers trying to use unchecked and unreliable data, relying on specific userspace behavior. Note: Such unsafe driver behavior has been found and fixed in the tg3 driver. Signed-off-by: Heiner Kallweit <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ff73f83 commit 344f7a4

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

net/ethtool/ioctl.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,17 +1514,12 @@ static void eee_to_keee(struct ethtool_keee *keee,
15141514
{
15151515
memset(keee, 0, sizeof(*keee));
15161516

1517-
keee->eee_active = eee->eee_active;
15181517
keee->eee_enabled = eee->eee_enabled;
15191518
keee->tx_lpi_enabled = eee->tx_lpi_enabled;
15201519
keee->tx_lpi_timer = eee->tx_lpi_timer;
15211520

1522-
ethtool_convert_legacy_u32_to_link_mode(keee->supported,
1523-
eee->supported);
15241521
ethtool_convert_legacy_u32_to_link_mode(keee->advertised,
15251522
eee->advertised);
1526-
ethtool_convert_legacy_u32_to_link_mode(keee->lp_advertised,
1527-
eee->lp_advertised);
15281523
}
15291524

15301525
static void keee_to_eee(struct ethtool_eee *eee,

0 commit comments

Comments
 (0)