Message ID | 1686605822-34544-1-git-send-email-justin.chen@broadcom.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp154650vqr; Mon, 12 Jun 2023 14:58:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4N9BqdnIh13UbImMsi6V8ziY026ES3guHioE2RdLqj1cwv59+8Inx2+Exn2zNX6DC6ENZv X-Received: by 2002:a17:907:6e08:b0:978:6c50:dde5 with SMTP id sd8-20020a1709076e0800b009786c50dde5mr10361557ejc.36.1686607096812; Mon, 12 Jun 2023 14:58:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686607096; cv=none; d=google.com; s=arc-20160816; b=iFuKv1ZhqpFghIHYaw5yg0cgXTjdfCLkc87TzgOTkP85Ww2QeBiKTAZXNKjccJAkGA 4tIYE1KD9az/L+7y10vLUNB7Q6UJjFyk1Miig3UmtNPvh3cjlPtTP4+9eianMgXbIfGs NS/P32x17JnULyv7zQYkK0VvEBmqvdgjnCbnkvs1KioZtKn//2yCaj1KQHhfnSgwd4Uu wH1G0a5fhQuhTtEM5OC3po9PHgrPQE1uigMvsvOYq88bpankVT2/14k0k9waEE1qLREP RlrPBsKC9oiPbFFyy5GwiezEft/GakzD8y/+htlEoWTtjo1wiegA9ZMWUwX0MeRU4aVH d4gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=aSdrnuMshC/4W1nW87NbjCUKCl0KaAun1ATAheUZGcw=; b=dAI2lgKCd9NqW9BUtUE8fbt1AMznzzQijDGrlOFOH8d9tlSmZfHzpjXGITEMIXb2Nz UxUJ/6n64cTgIvNL5deFkLS+pbnBZ49DjHGGBS+0G2bcJct1fkZBz+tvdmGe1YMs5LH+ q7zvTwXI2Vqg5eGAtGMuXdBMWHEcjWALqBDrkjLNy5RDG06LovFPRK+T4e6f6qHhy7xu ojPTnpBO+BLl2e/iDBqS0tzTN/u2ol/RHXxnbfk5ug+ZQJ5UbUdV91ULaER630xu+ZXN kB4VwF4/aaRK5OMJ8RC/vbVsh1PrVIF7/7Ik2HpWX4Nh2x4Dk8Wd2g/9IXpKOgRQGeRg U92w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=SqGCBzLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y20-20020a170906471400b0097e2a90d223si3992008ejq.720.2023.06.12.14.57.52; Mon, 12 Jun 2023 14:58:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=SqGCBzLt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237269AbjFLVhM (ORCPT <rfc822;rust.linux@gmail.com> + 99 others); Mon, 12 Jun 2023 17:37:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229749AbjFLVhK (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 12 Jun 2023 17:37:10 -0400 Received: from mail-qv1-xf33.google.com (mail-qv1-xf33.google.com [IPv6:2607:f8b0:4864:20::f33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 330BF90 for <linux-kernel@vger.kernel.org>; Mon, 12 Jun 2023 14:37:10 -0700 (PDT) Received: by mail-qv1-xf33.google.com with SMTP id 6a1803df08f44-62de3360ce8so2610056d6.3 for <linux-kernel@vger.kernel.org>; Mon, 12 Jun 2023 14:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686605829; x=1689197829; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aSdrnuMshC/4W1nW87NbjCUKCl0KaAun1ATAheUZGcw=; b=SqGCBzLt9n6ZmfEVUMJQSuvSgGSq0VWX0vwhPIgWEchaEOwXr3c55/waqECc6wHQWx HpBFJPurJkPPTHvLU2grOl4wmB46akc9G6BVjK845rp0D7KARXznU8x2X7zUKeaJLz94 DZEPk7Uli2sPvQJlf3gJgwKmwkP5cWxeOm5uc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686605829; x=1689197829; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aSdrnuMshC/4W1nW87NbjCUKCl0KaAun1ATAheUZGcw=; b=NX4CV6P6eNLkom5MY8ILXqsqoSSwFjl7uLcTvXMydnpxZ33HSu0VoATGg7kehI/Hz1 2ZtsRqYT7t+TeFR8X355fQtPkxQ7xBZ6oSPNCYPE/VUM8xIZgGHrHhmIsBMfsWYGp55A DYhJOdZiH8sYwIMMNaFIJyjYEphjfdqt5w/eGdHuGH1FE1zhL/iupphs4pyPbPAdybk0 arH+QLHZsDtk4t2KhMMo80pbifZLIXjlIz1zL5Pop3ugW9vnRuR7b6s33p9v/Nd3CzjS Sj7oYP0xLGkUzkwKJ9Pll642fH2NWI71ABP7rWTELESGhy5ADoH66MwkaRFHYzozY6zM fU7g== X-Gm-Message-State: AC+VfDzww4riHGch/piplA3oZ3rlEpLV1olKmSxcJubawF0ZPMpSG4u1 qstUa/3c9YPkrf0oY1Zatsp7XQ== X-Received: by 2002:a05:6214:488:b0:62d:e946:518c with SMTP id pt8-20020a056214048800b0062de946518cmr6802933qvb.56.1686605829230; Mon, 12 Jun 2023 14:37:09 -0700 (PDT) Received: from stbirv-lnx-2.igp.broadcom.net ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id c17-20020a0ce651000000b00621268e14efsm3496429qvn.55.2023.06.12.14.37.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2023 14:37:08 -0700 (PDT) From: Justin Chen <justin.chen@broadcom.com> To: netdev@vger.kernel.org Cc: bcm-kernel-feedback-list@broadcom.com, Justin Chen <justin.chen@broadcom.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Andrew Lunn <andrew@lunn.ch>, Daniil Tatianin <d-tatianin@yandex-team.ru>, Marco Bonelli <marco@mebeim.net>, Vincent Mailhol <mailhol.vincent@wanadoo.fr>, Maxim Korotkov <korotkov.maxim.s@gmail.com>, Gal Pressman <gal@nvidia.com>, Jiri Pirko <jiri@resnulli.us>, Kuniyuki Iwashima <kuniyu@amazon.com>, Simon Horman <simon.horman@corigine.com>, Florian Fainelli <florian.fainelli@broadcom.com>, linux-kernel@vger.kernel.org (open list) Subject: [PATCH net-next] ethtool: ioctl: account for sopass diff in set_wol Date: Mon, 12 Jun 2023 14:37:00 -0700 Message-Id: <1686605822-34544-1-git-send-email-justin.chen@broadcom.com> X-Mailer: git-send-email 2.7.4 Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000058f48205fdf58599" X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, MIME_HEADER_CTYPE_ONLY,MIME_NO_TEXT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,T_TVD_MIME_NO_HEADERS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768535723119718965?= X-GMAIL-MSGID: =?utf-8?q?1768535723119718965?= |
Series |
[net-next] ethtool: ioctl: account for sopass diff in set_wol
|
|
Commit Message
Justin Chen
June 12, 2023, 9:37 p.m. UTC
sopass won't be set if wolopt doesn't change. This means the following
will fail to set the correct sopass.
ethtool -s eth0 wol s sopass 11:22:33:44:55:66
ethtool -s eth0 wol s sopass 22:44:55:66:77:88
Make sure we call into the driver layer set_wol if sopass is different.
Fixes: 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol")
Signed-off-by: Justin Chen <justin.chen@broadcom.com>
---
Note: Tagged "Fixes" patch has not hit rc yet.
net/ethtool/ioctl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On Mon, Jun 12, 2023 at 02:37:00PM -0700, Justin Chen wrote: > sopass won't be set if wolopt doesn't change. This means the following > will fail to set the correct sopass. > ethtool -s eth0 wol s sopass 11:22:33:44:55:66 > ethtool -s eth0 wol s sopass 22:44:55:66:77:88 > > Make sure we call into the driver layer set_wol if sopass is different. > > Fixes: 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol") > Signed-off-by: Justin Chen <justin.chen@broadcom.com> > --- > > Note: Tagged "Fixes" patch has not hit rc yet. > > net/ethtool/ioctl.c | 3 ++- Hi Justin Does the netlink version get this correct? And just for my own curiosity, why are you so interested in the ioctl version, which is deprecated and not used by modern versions of ethtool? Andrew
On 6/12/23 3:28 PM, Andrew Lunn wrote: > On Mon, Jun 12, 2023 at 02:37:00PM -0700, Justin Chen wrote: >> sopass won't be set if wolopt doesn't change. This means the following >> will fail to set the correct sopass. >> ethtool -s eth0 wol s sopass 11:22:33:44:55:66 >> ethtool -s eth0 wol s sopass 22:44:55:66:77:88 >> >> Make sure we call into the driver layer set_wol if sopass is different. >> >> Fixes: 55b24334c0f2 ("ethtool: ioctl: improve error checking for set_wol") >> Signed-off-by: Justin Chen <justin.chen@broadcom.com> >> --- >> >> Note: Tagged "Fixes" patch has not hit rc yet. >> >> net/ethtool/ioctl.c | 3 ++- > > Hi Justin > > Does the netlink version get this correct? > Yup netlink gets this correct > And just for my own curiosity, why are you so interested in the ioctl > version, which is deprecated and not used by modern versions of > ethtool? > No particular reason. I was working on another driver and was planning to remove the set_wol error checking in the driver layer when I realized netlink set_wol was already doing it. Then on further inspection I noticed the ioctl version doesn't do the same thing. Justin > Andrew
Hello: This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <kuba@kernel.org>: On Mon, 12 Jun 2023 14:37:00 -0700 you wrote: > sopass won't be set if wolopt doesn't change. This means the following > will fail to set the correct sopass. > ethtool -s eth0 wol s sopass 11:22:33:44:55:66 > ethtool -s eth0 wol s sopass 22:44:55:66:77:88 > > Make sure we call into the driver layer set_wol if sopass is different. > > [...] Here is the summary with links: - [net-next] ethtool: ioctl: account for sopass diff in set_wol https://git.kernel.org/netdev/net-next/c/2bddad9ec65a You are awesome, thank you!
diff --git a/net/ethtool/ioctl.c b/net/ethtool/ioctl.c index 37b582225854..4a51e0ec295c 100644 --- a/net/ethtool/ioctl.c +++ b/net/ethtool/ioctl.c @@ -1452,7 +1452,8 @@ static int ethtool_set_wol(struct net_device *dev, char __user *useraddr) if (wol.wolopts & ~cur_wol.supported) return -EINVAL; - if (wol.wolopts == cur_wol.wolopts) + if (wol.wolopts == cur_wol.wolopts && + !memcmp(wol.sopass, cur_wol.sopass, sizeof(wol.sopass))) return 0; ret = dev->ethtool_ops->set_wol(dev, &wol);