aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2024-03-02 15:18:27 +0100
committerJakub Kicinski <kuba@kernel.org>2024-03-05 19:07:13 -0800
commit344f7a4651497ffc62166ec6318b33f79d71c3df (patch)
tree06554963f9cfd567f956107eda96c76e592b3ddd
parentsock: Use unsafe_memcpy() for sock_copy() (diff)
downloadwireguard-linux-344f7a4651497ffc62166ec6318b33f79d71c3df.tar.xz
wireguard-linux-344f7a4651497ffc62166ec6318b33f79d71c3df.zip
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 <hkallweit1@gmail.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/ad7ee11e-eb7a-4975-9122-547e13a161d8@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--net/ethtool/ioctl.c5
1 files changed, 0 insertions, 5 deletions
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c
index 317308bdbda9..5a55270aa86e 100644
--- a/net/ethtool/ioctl.c
+++ b/net/ethtool/ioctl.c
@@ -1514,17 +1514,12 @@ static void eee_to_keee(struct ethtool_keee *keee,
{
memset(keee, 0, sizeof(*keee));
- keee->eee_active = eee->eee_active;
keee->eee_enabled = eee->eee_enabled;
keee->tx_lpi_enabled = eee->tx_lpi_enabled;
keee->tx_lpi_timer = eee->tx_lpi_timer;
- ethtool_convert_legacy_u32_to_link_mode(keee->supported,
- eee->supported);
ethtool_convert_legacy_u32_to_link_mode(keee->advertised,
eee->advertised);
- ethtool_convert_legacy_u32_to_link_mode(keee->lp_advertised,
- eee->lp_advertised);
}
static void keee_to_eee(struct ethtool_eee *eee,