Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp4323912ybv; Sun, 16 Feb 2020 19:30:49 -0800 (PST) X-Google-Smtp-Source: APXvYqx7Y5aKzxxJSIX/0PwaLvSB1Asm8GFrtskQO8pALIwG3kVZ7gX/WUuVJYTaUGVYmnrLgPr6 X-Received: by 2002:a9d:6ad6:: with SMTP id m22mr11245417otq.7.1581910249540; Sun, 16 Feb 2020 19:30:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581910249; cv=none; d=google.com; s=arc-20160816; b=GIxYOAAOWZXNr6mmwQZnUy1py6IVyJ0gCJMr7BhcGX5UK0Mp/Vhd+5pjrlhgxXf3/U CDFPYO9JWa2UnTFytIs+cjVgqEP8bHCaN70nbmpshPvjsPWIDvuq7VALn/UwfqxDcURB EY8fs0haLSL3ECcx4h2ZigWXIphOYLsCBfxn2URY8BE6qpDX+UeETy8RX2+reuvrmvD7 cM04p79UzAd3DTgNNF/5jzvzXT+S2FlR6+n2dBANWbnf/ElZYUqfhaJOlAmLH1JNZPPx zAVuxc9C9WdU+6v0xnqqbyiu2k8nJpL9+tHUc8KCZya8sXdjKR5DVR+olkv0Awp57M9N nXAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:from:subject:cc:to:message-id:date; bh=ykqYlBFpSVWZrqCNAgB6QzWWOTLYaXH/ybe47BZuX3U=; b=c0WpGN/4Vy0V6Lg3MA76ZBtL6kcVPt2b7SZpG94O2tlA+Q5bjfNmingSQAkXBTrLz+ Dt8utSxy5PmskJLqk+ScBBstb4hc0R4v9WccXKwwT5kKlQOSJ1phA91oV4XnyBlfdkxJ NYdnllvA5G1qOTuC8f6sF7mYuP8qw8PGya9KYhSS57FnKxde7//MgPnEVBYAg6CEr8Zs MxpkUPS/+/sr8AmR1H1U8VmJoFCjNA5JLReixgErSc2VJRsRp3vaIMLoe5c91tletF1g CUcsAkFDBWWEub/Y/Is3aDE6mFQg8GPhviDBXutFZ09T4X/7StZLDYTZU6CP3P7k6pKw t2lQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q28si5813236oij.149.2020.02.16.19.30.37; Sun, 16 Feb 2020 19:30:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727889AbgBQD33 (ORCPT + 99 others); Sun, 16 Feb 2020 22:29:29 -0500 Received: from shards.monkeyblade.net ([23.128.96.9]:48272 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726672AbgBQD33 (ORCPT ); Sun, 16 Feb 2020 22:29:29 -0500 Received: from localhost (unknown [IPv6:2601:601:9f00:477::3d5]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: davem-davemloft) by shards.monkeyblade.net (Postfix) with ESMTPSA id D5A69157413F9; Sun, 16 Feb 2020 19:29:28 -0800 (PST) Date: Sun, 16 Feb 2020 19:29:28 -0800 (PST) Message-Id: <20200216.192928.1291469951934245769.davem@davemloft.net> To: mkubecek@suse.cz Cc: kuba@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] ethtool: fix application of verbose no_mask bitset From: David Miller In-Reply-To: <20200215005553.4D202E03D6@unicorn.suse.cz> References: <20200215005553.4D202E03D6@unicorn.suse.cz> X-Mailer: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Sun, 16 Feb 2020 19:29:29 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michal Kubecek Date: Sat, 15 Feb 2020 01:55:53 +0100 (CET) > A bitset without mask in a _SET request means we want exactly the bits in > the bitset to be set. This works correctly for compact format but when > verbose format is parsed, ethnl_update_bitset32_verbose() only sets the > bits present in the request bitset but does not clear the rest. This can > cause incorrect results like > > lion:~ # ethtool eth0 | grep Wake > Supports Wake-on: pumbg > Wake-on: g > lion:~ # ethtool -s eth0 wol u > lion:~ # ethtool eth0 | grep Wake > Supports Wake-on: pumbg > Wake-on: ug > > when the second ethtool command issues request > > ETHTOOL_MSG_WOL_SET > ETHTOOL_A_WOL_HEADER > ETHTOOL_A_HEADER_DEV_NAME = "eth0" > ETHTOOL_A_WOL_MODES > ETHTOOL_A_BITSET_NOMASK > ETHTOOL_A_BITSET_BITS > ETHTOOL_A_BITSET_BITS_BIT > ETHTOOL_BITSET_BIT_INDEX = 1 > > Fix the logic by clearing the whole target bitmap before we start iterating > through the request bits. > > Fixes: 10b518d4e6dd ("ethtool: netlink bitset handling") > Signed-off-by: Michal Kubecek Applied, thanks Michal.