]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ethtool: Fix wrong mod state in case of verbose and no_mask bitset
authorKory Maincent <kory.maincent@bootlin.com>
Mon, 2 Dec 2024 15:33:57 +0000 (16:33 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:03:08 +0000 (20:03 +0100)
commit22074dc1d4d3ea14ef6313ae4337cb07778498d6
tree9ea4ea376886b8d4f7e1e08473d39f1492432e13
parentbe4d0ac67d92e6a285cd3eeb672188d249c121b2
ethtool: Fix wrong mod state in case of verbose and no_mask bitset

[ Upstream commit 910c4788d6155b2202ec88273376cd7ecdc24f0a ]

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. The commit
6699170376ab ("ethtool: fix application of verbose no_mask bitset") fixes
this issue by clearing the whole target bitmap before we start iterating.
The solution proposed brought an issue with the behavior of the mod
variable. As the bitset is always cleared the old value will always
differ to the new value.

Fix it by adding a new function to compare bitmaps and a temporary variable
which save the state of the old bitmap.

Fixes: 6699170376ab ("ethtool: fix application of verbose no_mask bitset")
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20241202153358.1142095-1-kory.maincent@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ethtool/bitset.c