mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: netdev@vger.kernel.org
Cc: Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Woojung Huh <woojung.huh@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Steve Glendinning <steve.glendinning@shawell.net>,
	Kees Cook <keescook@chromium.org>,
	Alexander Kurz <akurz@blala.de>,
	Hayes Wang <hayeswang@realtek.com>,
	Kai-Heng Feng <kai.heng.feng@canonical.com>,
	Grant Grundler <grundler@chromium.org>,
	zhong jiang <zhongjiang@huawei.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Ran Wang <ran.wang_1@nxp.com>, Eric Dumazet <edumazet@google.com>,
	linux-usb@vger.kernel.org (open list:USB NETWORKING DRIVERS),
	linux-kernel@vger.kernel.org (open list)
Subject: [PATCH net v2 3/7] lan78xx: Check for supported Wake-on-LAN modes
Date: Fri, 28 Sep 2018 16:18:52 -0700	[thread overview]
Message-ID: <20180928231856.3587-4-f.fainelli@gmail.com> (raw)
In-Reply-To: <20180928231856.3587-1-f.fainelli@gmail.com>

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>
---
 drivers/net/usb/lan78xx.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/net/usb/lan78xx.c b/drivers/net/usb/lan78xx.c
index a9991c5f4736..c3c9ba44e2a1 100644
--- a/drivers/net/usb/lan78xx.c
+++ b/drivers/net/usb/lan78xx.c
@@ -1401,19 +1401,10 @@ static int lan78xx_set_wol(struct net_device *netdev,
 	if (ret < 0)
 		return ret;
 
-	pdata->wol = 0;
-	if (wol->wolopts & WAKE_UCAST)
-		pdata->wol |= WAKE_UCAST;
-	if (wol->wolopts & WAKE_MCAST)
-		pdata->wol |= WAKE_MCAST;
-	if (wol->wolopts & WAKE_BCAST)
-		pdata->wol |= WAKE_BCAST;
-	if (wol->wolopts & WAKE_MAGIC)
-		pdata->wol |= WAKE_MAGIC;
-	if (wol->wolopts & WAKE_PHY)
-		pdata->wol |= WAKE_PHY;
-	if (wol->wolopts & WAKE_ARP)
-		pdata->wol |= WAKE_ARP;
+	if (wol->wolopts & ~WAKE_ALL)
+		return -EINVAL;
+
+	pdata->wol = wol->wolopts;
 
 	device_set_wakeup_enable(&dev->udev->dev, (bool)wol->wolopts);
 
-- 
2.17.1


  parent reply	other threads:[~2018-09-28 23:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-28 23:18 [PATCH net v2 0/7] net: usb: Check for " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 1/7] asix: Check for supported " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 2/7] ax88179_178a: " Florian Fainelli
2018-09-28 23:18 ` Florian Fainelli [this message]
2018-09-28 23:27   ` [PATCH net v2 3/7] lan78xx: " Woojung.Huh
2018-09-28 23:18 ` [PATCH net v2 4/7] sr9800: " Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
2018-09-28 23:18 ` [PATCH net v2 7/7] smsc95xx: " Florian Fainelli
2018-09-29 18:32 ` [PATCH net v2 0/7] net: usb: " David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180928231856.3587-4-f.fainelli@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=akurz@blala.de \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=grundler@chromium.org \
    --cc=hayeswang@realtek.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=ran.wang_1@nxp.com \
    --cc=steve.glendinning@shawell.net \
    --cc=woojung.huh@microchip.com \
    --cc=zhongjiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome