mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error
@ 2024-08-05 23:52 Tristram.Ha
  2024-08-05 23:54 ` Florian Fainelli
  2024-08-07  2:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Tristram.Ha @ 2024-08-05 23:52 UTC (permalink / raw)
  To: Woojung Huh, Andrew Lunn, Vivien Didelot, Florian Fainelli,
	Vladimir Oltean
  Cc: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, UNGLinuxDriver, netdev, linux-kernel, Tristram Ha

From: Tristram Ha <tristram.ha@microchip.com>

The wol variable in ksz_port_set_mac_address() is declared with random
data, but the code in ksz_get_wol call may not be executed so the
WAKE_MAGIC check may be invalid resulting in an error message when
setting a MAC address after starting the DSA driver.

Fixes: 3b454b6390c3 ("net: dsa: microchip: ksz9477: Add Wake on Magic Packet support")
Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
v2
- Update with Oleksij's suggestion

 drivers/net/dsa/microchip/ksz_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index b074b4bb0629..b120e66d5669 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -3764,6 +3764,11 @@ static int ksz_port_set_mac_address(struct dsa_switch *ds, int port,
 		return -EBUSY;
 	}
 
+	/* Need to initialize variable as the code to fill in settings may
+	 * not be executed.
+	 */
+	wol.wolopts = 0;
+
 	ksz_get_wol(ds, dp->index, &wol);
 	if (wol.wolopts & WAKE_MAGIC) {
 		dev_err(ds->dev,
-- 
2.34.1


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

* Re: [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error
  2024-08-05 23:52 [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error Tristram.Ha
@ 2024-08-05 23:54 ` Florian Fainelli
  2024-08-07  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2024-08-05 23:54 UTC (permalink / raw)
  To: Tristram.Ha, Woojung Huh, Andrew Lunn, Vivien Didelot, Vladimir Oltean
  Cc: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, UNGLinuxDriver, netdev, linux-kernel

On 8/5/24 16:52, Tristram.Ha@microchip.com wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
> 
> The wol variable in ksz_port_set_mac_address() is declared with random
> data, but the code in ksz_get_wol call may not be executed so the
> WAKE_MAGIC check may be invalid resulting in an error message when
> setting a MAC address after starting the DSA driver.
> 
> Fixes: 3b454b6390c3 ("net: dsa: microchip: ksz9477: Add Wake on Magic Packet support")
> Signed-off-by: Tristram Ha <tristram.ha@microchip.com>
> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian


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

* Re: [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error
  2024-08-05 23:52 [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error Tristram.Ha
  2024-08-05 23:54 ` Florian Fainelli
@ 2024-08-07  2:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-08-07  2:40 UTC (permalink / raw)
  To: Tristram.Ha
  Cc: woojung.huh, andrew, vivien.didelot, f.fainelli, olteanv,
	o.rempel, davem, edumazet, kuba, pabeni, UNGLinuxDriver, netdev,
	linux-kernel, tristram.ha

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 5 Aug 2024 16:52:00 -0700 you wrote:
> From: Tristram Ha <tristram.ha@microchip.com>
> 
> The wol variable in ksz_port_set_mac_address() is declared with random
> data, but the code in ksz_get_wol call may not be executed so the
> WAKE_MAGIC check may be invalid resulting in an error message when
> setting a MAC address after starting the DSA driver.
> 
> [...]

Here is the summary with links:
  - [net,v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error
    https://git.kernel.org/netdev/net/c/c7a19018bd55

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-08-07  2:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-05 23:52 [PATCH net v2] net: dsa: microchip: Fix Wake-on-LAN check to not return an error Tristram.Ha
2024-08-05 23:54 ` Florian Fainelli
2024-08-07  2:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®