From mboxrd@z Thu Jan 1 00:00:00 1970 From: Heiner Kallweit Subject: [PATCH net-next] r8169: reject unsupported WoL options Date: Mon, 25 Jun 2018 20:34:41 +0200 Message-ID: <85243a82-291f-71d7-7519-b6e9dc19463b@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: "netdev@vger.kernel.org" To: Realtek linux nic maintainers , David Miller Return-path: Received: from mail-wm0-f68.google.com ([74.125.82.68]:40309 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964851AbeFYSex (ORCPT ); Mon, 25 Jun 2018 14:34:53 -0400 Received: by mail-wm0-f68.google.com with SMTP id z13-v6so4901423wma.5 for ; Mon, 25 Jun 2018 11:34:52 -0700 (PDT) Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: So far unsupported WoL options are silently ignored. Change this and reject attempts to set unsupported options. This prevents situations where a user tries to set an unsupported WoL option and is under the impression it was successful because ethtool doesn't complain. Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/realtek/r8169.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c index 1d33672c..70c13cc2 100644 --- a/drivers/net/ethernet/realtek/r8169.c +++ b/drivers/net/ethernet/realtek/r8169.c @@ -1712,11 +1712,14 @@ static int rtl8169_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) struct rtl8169_private *tp = netdev_priv(dev); struct device *d = tp_to_dev(tp); + if (wol->wolopts & ~WAKE_ANY) + return -EINVAL; + pm_runtime_get_noresume(d); rtl_lock_work(tp); - tp->saved_wolopts = wol->wolopts & WAKE_ANY; + tp->saved_wolopts = wol->wolopts; if (pm_runtime_active(d)) __rtl8169_set_wol(tp, tp->saved_wolopts); -- 2.18.0