sr9800: Check for supported Wake-on-LAN modes
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 28 Sep 2018 23:18:53 +0000 (16:18 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 16 Dec 2018 22:09:29 +0000 (22:09 +0000)
commit c5cb93e994ffb43b7b3b1ff10b9f928f54574a36 upstream.

The driver currently silently accepts unsupported Wake-on-LAN modes
(other than WAKE_PHY or WAKE_MAGIC) without reporting that to the user,
which is confusing.

Fixes: 19a38d8e0aa3 ("USB2NET : SR9800 : One chip USB2.0 USB2NET SR9800 Device Driver Support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/net/usb/sr9800.c

index 953de13267df19d6fcefe60c2008f6222ca5775c..0144fb19a099ce9c375d08fb9089cbff6d015dcb 100644 (file)
@@ -421,6 +421,9 @@ sr_set_wol(struct net_device *net, struct ethtool_wolinfo *wolinfo)
        struct usbnet *dev = netdev_priv(net);
        u8 opt = 0;
 
+       if (wolinfo->wolopts & ~(WAKE_PHY | WAKE_MAGIC))
+               return -EINVAL;
+
        if (wolinfo->wolopts & WAKE_PHY)
                opt |= SR_MONITOR_LINK;
        if (wolinfo->wolopts & WAKE_MAGIC)