Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lan78xx: Check for supported Wake-on-LAN modes

The driver supports a fair amount of Wake-on-LAN modes, but is not
checking that the user specified one that is supported.

Fixes: 55d7de9de6c3 ("Microchip's LAN7800 family USB 2/3 to 10/100/1000 Ethernet device driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Woojung Huh <Woojung.Huh@Microchip.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Florian Fainelli and committed by
David S. Miller
eb9ad088 5ba6b4aa

+4 -13
+4 -13
drivers/net/usb/lan78xx.c
··· 1401 1401 if (ret < 0) 1402 1402 return ret; 1403 1403 1404 - pdata->wol = 0; 1405 - if (wol->wolopts & WAKE_UCAST) 1406 - pdata->wol |= WAKE_UCAST; 1407 - if (wol->wolopts & WAKE_MCAST) 1408 - pdata->wol |= WAKE_MCAST; 1409 - if (wol->wolopts & WAKE_BCAST) 1410 - pdata->wol |= WAKE_BCAST; 1411 - if (wol->wolopts & WAKE_MAGIC) 1412 - pdata->wol |= WAKE_MAGIC; 1413 - if (wol->wolopts & WAKE_PHY) 1414 - pdata->wol |= WAKE_PHY; 1415 - if (wol->wolopts & WAKE_ARP) 1416 - pdata->wol |= WAKE_ARP; 1404 + if (wol->wolopts & ~WAKE_ALL) 1405 + return -EINVAL; 1406 + 1407 + pdata->wol = wol->wolopts; 1417 1408 1418 1409 device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts); 1419 1410