netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
@ 2024-11-18 14:03 Oleksij Rempel
  2024-11-18 17:02 ` Florian Fainelli
  2024-11-25  1:00 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2024-11-18 14:03 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Woojung Huh, Andrew Lunn
  Cc: Oleksij Rempel, Florian Fainelli, kernel, linux-kernel, netdev,
	UNGLinuxDriver, Phil Elwell

Validate Wake-on-LAN (WoL) options in `lan78xx_set_wol` before calling
`usb_autopm_get_interface`. This prevents USB autopm refcounting issues
and ensures the adapter can properly enter autosuspend when invalid WoL
options are provided.

Fixes: eb9ad088f966 ("lan78xx: Check for supported Wake-on-LAN modes")
Cc: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/usb/lan78xx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index 9f191b6ce821..531b1b6a37d1 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1652,13 +1652,13 @@ static int lan78xx_set_wol(struct net_device *netdev,
 	struct lan78xx_priv *pdata = (struct lan78xx_priv *)(dev->data[0]);
 	int ret;
 
+	if (wol->wolopts & ~WAKE_ALL)
+		return -EINVAL;
+
 	ret = usb_autopm_get_interface(dev->intf);
 	if (ret < 0)
 		return ret;
 
-	if (wol->wolopts & ~WAKE_ALL)
-		return -EINVAL;
-
 	pdata->wol = wol->wolopts;
 
 	device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);
-- 
2.39.5


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

* Re: [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
  2024-11-18 14:03 [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration Oleksij Rempel
@ 2024-11-18 17:02 ` Florian Fainelli
  2024-11-25  1:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2024-11-18 17:02 UTC (permalink / raw)
  To: Oleksij Rempel, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Woojung Huh, Andrew Lunn
  Cc: kernel, linux-kernel, netdev, UNGLinuxDriver, Phil Elwell

On 11/18/24 06:03, Oleksij Rempel wrote:
> Validate Wake-on-LAN (WoL) options in `lan78xx_set_wol` before calling
> `usb_autopm_get_interface`. This prevents USB autopm refcounting issues
> and ensures the adapter can properly enter autosuspend when invalid WoL
> options are provided.
> 
> Fixes: eb9ad088f966 ("lan78xx: Check for supported Wake-on-LAN modes")
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>

Acked-by: Florian Fainelli <f.fainelli@gmail.com>

Thank you!
-- 
Florian

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

* Re: [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
  2024-11-18 14:03 [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration Oleksij Rempel
  2024-11-18 17:02 ` Florian Fainelli
@ 2024-11-25  1:00 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-25  1:00 UTC (permalink / raw)
  To: Oleksij Rempel
  Cc: davem, edumazet, kuba, pabeni, woojung.huh, andrew+netdev,
	f.fainelli, kernel, linux-kernel, netdev, UNGLinuxDriver, phil

Hello:

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

On Mon, 18 Nov 2024 15:03:51 +0100 you wrote:
> Validate Wake-on-LAN (WoL) options in `lan78xx_set_wol` before calling
> `usb_autopm_get_interface`. This prevents USB autopm refcounting issues
> and ensures the adapter can properly enter autosuspend when invalid WoL
> options are provided.
> 
> Fixes: eb9ad088f966 ("lan78xx: Check for supported Wake-on-LAN modes")
> Cc: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> 
> [...]

Here is the summary with links:
  - [net,v1,1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
    https://git.kernel.org/netdev/net/c/e863ff806f72

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-11-25  1:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-18 14:03 [PATCH net v1 1/1] net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration Oleksij Rempel
2024-11-18 17:02 ` Florian Fainelli
2024-11-25  1:00 ` 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;
as well as URLs for NNTP newsgroup(s).