Skip to content

Commit e863ff8

Browse files
oleremkuba-moo
authored andcommitted
net: usb: lan78xx: Fix refcounting and autosuspend on invalid WoL configuration
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: eb9ad08 ("lan78xx: Check for supported Wake-on-LAN modes") Signed-off-by: Oleksij Rempel <[email protected]> Acked-by: Florian Fainelli <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 614f4d1 commit e863ff8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/net/usb/lan78xx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,13 +1652,13 @@ static int lan78xx_set_wol(struct net_device *netdev,
16521652
struct lan78xx_priv *pdata = (struct lan78xx_priv *)(dev->data[0]);
16531653
int ret;
16541654

1655+
if (wol->wolopts & ~WAKE_ALL)
1656+
return -EINVAL;
1657+
16551658
ret = usb_autopm_get_interface(dev->intf);
16561659
if (ret < 0)
16571660
return ret;
16581661

1659-
if (wol->wolopts & ~WAKE_ALL)
1660-
return -EINVAL;
1661-
16621662
pdata->wol = wol->wolopts;
16631663

16641664
device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);

0 commit comments

Comments
 (0)