All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] tg3: copy only needed fields from userspace-provided EEE data
@ 2024-02-18 14:49 Heiner Kallweit
  2024-02-18 17:04 ` Andrew Lunn
  2024-02-21 11:20 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Heiner Kallweit @ 2024-02-18 14:49 UTC (permalink / raw)
  To: Pavan Chebbi, Michael Chan, Jakub Kicinski, David Miller,
	Paolo Abeni, Eric Dumazet, Andrew Lunn, Russell King - ARM Linux
  Cc: netdev@vger.kernel.org

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>
---
 drivers/net/ethernet/broadcom/tg3.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 51685cd29..7a07c5216 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);
-- 
2.43.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-02-21 11:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-18 14:49 [PATCH net-next] tg3: copy only needed fields from userspace-provided EEE data Heiner Kallweit
2024-02-18 17:04 ` Andrew Lunn
2024-02-18 17:31   ` Heiner Kallweit
2024-02-21 11:20 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.