All of lore.kernel.org
 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 1/7] asix: Check for supported Wake-on-LAN modes
Date: Mon, 24 Sep 2018 13:54:14 -0700	[thread overview]
Message-ID: <20180924205420.31309-2-f.fainelli@gmail.com> (raw)
In-Reply-To: <20180924205420.31309-1-f.fainelli@gmail.com>

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: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/usb/asix_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index e95dd12edec4..023b8d0bf175 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -607,6 +607,9 @@ int asix_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 |= AX_MONITOR_LINK;
 	if (wolinfo->wolopts & WAKE_MAGIC)
-- 
2.17.1


WARNING: multiple messages have this Message-ID (diff)
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>,
	"open list:USB NETWORKING DRIVERS" <linux-usb@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Subject: [net,1/7] asix: Check for supported Wake-on-LAN modes
Date: Mon, 24 Sep 2018 13:54:14 -0700	[thread overview]
Message-ID: <20180924205420.31309-2-f.fainelli@gmail.com> (raw)

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: 2e55cc7210fe ("[PATCH] USB: usbnet (3/9) module for ASIX Ethernet adapters")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/usb/asix_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/usb/asix_common.c b/drivers/net/usb/asix_common.c
index e95dd12edec4..023b8d0bf175 100644
--- a/drivers/net/usb/asix_common.c
+++ b/drivers/net/usb/asix_common.c
@@ -607,6 +607,9 @@ int asix_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 |= AX_MONITOR_LINK;
 	if (wolinfo->wolopts & WAKE_MAGIC)

  reply	other threads:[~2018-09-24 20:55 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 20:54 [PATCH net 0/7] net: usb: Check for Wake-on-LAN modes Florian Fainelli
2018-09-24 20:54 ` Florian Fainelli [this message]
2018-09-24 20:54   ` [net,1/7] asix: Check for supported " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 2/7] ax88179_178a: " Florian Fainelli
2018-09-24 20:54   ` [net,2/7] " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 3/7] lan78xx: " Florian Fainelli
2018-09-24 20:54   ` [net,3/7] " Florian Fainelli
2018-09-25 17:19   ` [PATCH net 3/7] " Woojung.Huh
2018-09-25 17:19     ` [net,3/7] " Woojung.Huh
2018-09-25 17:26     ` [PATCH net 3/7] " Florian Fainelli
2018-09-25 17:26       ` [net,3/7] " Florian Fainelli
2018-09-25 17:32       ` [PATCH net 3/7] " Woojung.Huh
2018-09-25 17:32         ` [net,3/7] " Woojung.Huh
2018-09-25 18:35         ` [PATCH net 3/7] " Florian Fainelli
2018-09-25 18:35           ` [net,3/7] " Florian Fainelli
2018-09-25 22:32           ` [PATCH net 3/7] " Woojung.Huh
2018-09-25 22:32             ` [net,3/7] " Woojung.Huh
2018-09-24 20:54 ` [PATCH net 4/7] sr9800: " Florian Fainelli
2018-09-24 20:54   ` [net,4/7] " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 5/7] r8152: Check for supported Wake-on-LAN Modes Florian Fainelli
2018-09-24 20:54   ` [net,5/7] " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 6/7] smsc75xx: Check for Wake-on-LAN modes Florian Fainelli
2018-09-24 20:54   ` [net,6/7] " Florian Fainelli
2018-09-24 20:54 ` [PATCH net 7/7] smsc95xx: " Florian Fainelli
2018-09-24 20:54   ` [net,7/7] " Florian Fainelli
2018-09-27  0:12 ` [PATCH net 0/7] net: usb: " David Miller
2018-09-27  0:15   ` Florian Fainelli

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=20180924205420.31309-2-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.