ethtool: Fix mod state of verbose no_mask bitset
authorKory Maincent <kory.maincent@bootlin.com>
Mon, 9 Oct 2023 13:36:45 +0000 (15:36 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 11 Oct 2023 02:48:15 +0000 (19:48 -0700)
commit108a36d07c01edbc5942d27c92494d1c6e4d45a0
treed89b3e126b94657d865689f45337e3d731c58481
parentb52acd02c1dc5eb7bf3fb4da094687a3b26497aa
ethtool: Fix mod state of verbose no_mask bitset

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 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 val will
always differ to the new val.

Fix it by adding a new 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>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://lore.kernel.org/r/20231009133645.44503-1-kory.maincent@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ethtool/bitset.c