From patchwork Mon Sep 24 20:54:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Fainelli X-Patchwork-Id: 10612845 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 2D3B015A6 for ; Mon, 24 Sep 2018 20:55:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 211E929858 for ; Mon, 24 Sep 2018 20:55:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 15350285E3; Mon, 24 Sep 2018 20:55:58 +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 BC3B8285E3 for ; Mon, 24 Sep 2018 20:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728436AbeIYC7b (ORCPT ); Mon, 24 Sep 2018 22:59:31 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:40655 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725812AbeIYC73 (ORCPT ); Mon, 24 Sep 2018 22:59:29 -0400 Received: by mail-pf1-f194.google.com with SMTP id s5-v6so1841143pfj.7; Mon, 24 Sep 2018 13:55:25 -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=YUEBuRPQTzT8CGzg7GgPki5xla5ibOAm1oSIOW5aQ5a5A8WXdhAHyxsj6Wc1nYrknc ntJUvNH7yTsTxVNGNkvt/rNqe/T0bj9ooS+Wxvx3nn8LW0Vop+7g1c7LyqGJ/8OoDBkY +gyo/EPUmpd9TKYvvEekob2zGM6dGvjX+eU/xMXEwWA/Df6UQk/OMlR6RfdIh2Shxt0D GaUKBPgNW1H0SOQ85dSxq8lLLk8tLX/bM46fYxlpAU5P92vwFST06jEvTSmjFFO1AHgV QeUTPIpR45Msh34k7biTNkYaCgYDCzEmTLLs/1IWDFfbzSuMbre8OofgSgMyoySWDqrn mBdg== 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=kzsYrSjaaTO2ybeTmk8FwTwK73s0N5Tbtu1kE6+fQV0SJd6QJaiF7FWTCnAmbjo9cE bzGVAjKEt0CaoyO7i6dEe+WhhN2Z0DZIqv0bgD9YKPKFRt/N1bz0bRTFC5rCzOTrwW8Y UcIXVuSkTBZpdsinw5xVmoq5WBsXwWbNJ1BeWt0PRXZnGn1JUHed1XoMYoD4Rg7WoO1/ QC7HSG6c4M3SLCiYA8X0U1S1gXhLxx5bXnPsTMWkWAl2tU9JibpdXx0NvxAk1wRyYFB6 NDb/ywY83b58tZ8TPWC1/4VGhVvOqj0HPYlfmcYYMocY0+OrUVmYWOTSe60uRmTOHjJ0 5jHw== X-Gm-Message-State: ABuFfoieAXVoPoIb8eh7MUbTUPp4hS+kyn2F8bnHw3UZJGuD0Vcn5QI2 3s+08l10IWzZn/7wF2+GuZ+j2ZcJ X-Google-Smtp-Source: ACcGV60GkNZoQMsF2MNudIlwOdzYk0OxJ4zfUt4x2txWNL5Q3Fa/6a/HSmDIUPwO7stfpgh6tppArA== X-Received: by 2002:a63:ff1f:: with SMTP id k31-v6mr463132pgi.20.1537822525156; Mon, 24 Sep 2018 13:55:25 -0700 (PDT) Received: from fainelli-desktop.igp.broadcom.net ([192.19.223.250]) by smtp.gmail.com with ESMTPSA id b62-v6sm260160pfm.183.2018.09.24.13.55.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Sep 2018 13:55:23 -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 4/7] sr9800: Check for supported Wake-on-LAN modes Date: Mon, 24 Sep 2018 13:54:17 -0700 Message-Id: <20180924205420.31309-5-f.fainelli@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180924205420.31309-1-f.fainelli@gmail.com> References: <20180924205420.31309-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)