From patchwork Fri Sep 28 23:18:53 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10620541 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2B679112B for ; Fri, 28 Sep 2018 23:19:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C1212BAEE for ; Fri, 28 Sep 2018 23:19:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 106972BB12; Fri, 28 Sep 2018 23:19:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BDF452BAEE for ; Fri, 28 Sep 2018 23:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727606AbeI2Fpa (ORCPT ); Sat, 29 Sep 2018 01:45:30 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:54211 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726492AbeI2Fp3 (ORCPT ); Sat, 29 Sep 2018 01:45:29 -0400 Received: by mail-wm1-f67.google.com with SMTP id b19-v6so3666517wme.3; Fri, 28 Sep 2018 16:19:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=TKgRBdcbaLjCLYFNNphXO7D7Dwz80ZmX3ouxX2MzgvY=; b=fiyMGjACH7SDcTB1+tZSz1L/V932cPSByVOm0f2zm8CTItuiNIkj4wf9QHAysl9AMi BRUwV0+aeBbx1IxlNpScSyvD7hhOvQgbl5X5cYTGRZ/QZsB1pZbIOVC8lMeJA1L0/YDT /6K8geMWbG6PHy+zdqyUwZ9oQOdyY2t06QMYYC31/utc7HNov3HwsPZeiEyjTx2AHPNz 4a7do1UivlHnUstIO7wXhvdhxo6KmkWgMu4dTEQalAsEonjRYVtMb39y7+3R1PatJT+J CIl1g/K3Md7J/kIRxikemAhx9HX0Z8vIlRohaNIAOzaHhGXk8V/WEsRw79FSy193hByL pvIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=TKgRBdcbaLjCLYFNNphXO7D7Dwz80ZmX3ouxX2MzgvY=; b=CbWV7jAVHQ4W1nmVSyrn6KPj6G8vjbRxqKDX4gR8M7qzr2U8ODT8SRIhHHzt9jzoEz F0VHwrPfD/qij/4EKtVFT7HDcUtyhKqAu5oo++AwE8XgXQzYk3wXJNFlIU+7ftjlLWWe i/5QeRmNEjHSyLeBLZKjiOXIRVBXtEw7gLtiW+8SY5esWLm6wNHWEX+B5z7VQaHLY32I tBzZKYZPWeE/Y2hOKbsOOpZnM93WCvFC8KZyB2ymmxou8LxqohQJl2ayVMVlDdZUXzeQ ldKOLmh/xumcISqYBatMGvAOIio6XpZyKc5EnBSPRm4aagmEtZt8a99T4tCJHPyuZgSN j0Tg== X-Gm-Message-State: ABuFfojO2HJH9YYZz8pZOJVYzor8V4IB9tAx+gtYAOnhAuLwmgDd7O3Q yziwKJnW5NQE7HUVQCaG7LH1SW0Y X-Google-Smtp-Source: ACcGV61v4IEyTEZbBPwvjqt2GWiqrJr+dpLxY2/ZGphzfLHgKdZNncn7I5aKOhL1HllqGjzpNA0R8g== X-Received: by 2002:a1c:d785:: with SMTP id o127-v6mr3036028wmg.67.1538176766877; Fri, 28 Sep 2018 16:19:26 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id 11-v6sm8590730wrb.95.2018.09.28.16.19.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Sep 2018 16:19:25 -0700 (PDT) From: Florian Fainelli To: netdev@vger.kernel.org Cc: Florian Fainelli , "David S. Miller" , Woojung Huh , Microchip Linux Driver Support , Steve Glendinning , Kees Cook , Alexander Kurz , Hayes Wang , Kai-Heng Feng , Grant Grundler , zhong jiang , Sebastian Andrzej Siewior , Ran Wang , Eric Dumazet , linux-usb@vger.kernel.org (open list:USB NETWORKING DRIVERS), linux-kernel@vger.kernel.org (open list) Subject: [PATCH net v2 4/7] sr9800: Check for supported Wake-on-LAN modes Date: Fri, 28 Sep 2018 16:18:53 -0700 Message-Id: <20180928231856.3587-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180928231856.3587-1-f.fainelli@gmail.com> References: <20180928231856.3587-1-f.fainelli@gmail.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- drivers/net/usb/sr9800.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/usb/sr9800.c b/drivers/net/usb/sr9800.c index 9277a0f228df..35f39f23d881 100644 --- a/drivers/net/usb/sr9800.c +++ b/drivers/net/usb/sr9800.c @@ -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)