diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2024-02-18 17:49:55 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2024-02-21 14:15:12 +0300 |
commit | 8306ee08c0ff1c78672bcc645544f26f4d652cca (patch) | |
tree | 112ee2daa2de0fffa3d2d53962bbb064e59e273d | |
parent | b0117d136bb9e4a1facb7ce354e0580dde876f6b (diff) | |
download | linux-8306ee08c0ff1c78672bcc645544f26f4d652cca.tar.xz |
tg3: copy only needed fields from userspace-provided EEE data
The current code overwrites fields in tp->eee with unchecked data from
edata, e.g. the bitmap with supported modes. ethtool properly returns
the received data from get_eee() call, but we have no guarantee that
other users of the ioctl set_eee() interface behave properly too.
Therefore copy only fields which are actually needed.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 7d0a2f5f3282..ed93149f3b67 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -14200,7 +14200,9 @@ static int tg3_set_eee(struct net_device *dev, struct ethtool_keee *edata) return -EINVAL; } - tp->eee = *edata; + tp->eee.eee_enabled = edata->eee_enabled; + tp->eee.tx_lpi_enabled = edata->tx_lpi_enabled; + tp->eee.tx_lpi_timer = edata->tx_lpi_timer; tp->phy_flags |= TG3_PHYFLG_USER_CONFIGURED; tg3_warn_mgmt_link_flap(tp); |