alistair23-linux/net/ethtool
Michal Kubecek 6699170376 ethtool: fix application 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. 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: 10b518d4e6 ("ethtool: netlink bitset handling")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-02-16 19:28:51 -08:00
..
bitset.c ethtool: fix application of verbose no_mask bitset 2020-02-16 19:28:51 -08:00
bitset.h ethtool: netlink bitset handling 2019-12-27 16:40:01 -08:00
common.c ethtool: provide WoL settings with WOL_GET request 2020-01-27 11:31:36 +01:00
common.h ethtool: provide WoL settings with WOL_GET request 2020-01-27 11:31:36 +01:00
debug.c ethtool: add DEBUG_NTF notification 2020-01-27 11:31:36 +01:00
ioctl.c net/core: Replace driver version to be kernel version 2020-01-27 13:47:22 +01:00
linkinfo.c ethtool: add LINKINFO_NTF notification 2019-12-27 16:40:02 -08:00
linkmodes.c ethtool: remove set but not used variable 'lsettings' 2020-01-03 12:22:12 -08:00
linkstate.c ethtool: provide link state with LINKSTATE_GET request 2019-12-27 16:40:02 -08:00
Makefile ethtool: provide WoL settings with WOL_GET request 2020-01-27 11:31:36 +01:00
netlink.c ethtool: add WOL_NTF notification 2020-01-27 11:31:36 +01:00
netlink.h ethtool: set wake-on-lan settings with WOL_SET request 2020-01-27 11:31:36 +01:00
strset.c ethtool: provide WoL settings with WOL_GET request 2020-01-27 11:31:36 +01:00
wol.c ethtool: add WOL_NTF notification 2020-01-27 11:31:36 +01:00