On Mon, Jul 27, 2020 at 03:49:36PM -0700, Jacob Keller wrote:
> The ethtool netlink API can send bitsets without an associated bitmask.
> These do not get displayed properly, because the dump_link_modes, and
> bitset_get_bit to not check whether the provided bitset is a NOMASK
> bitset. This results in the inability to display peer advertised link
> modes.
> 
> Both the dump_link_modes and bitset_git_bit functions do not check
> ETHTOOL_A_BITSET_NOMASK, and thus do not properly handle bitsets which
> do not have a provided mask.
> 
> For compact bitmaps, things work more or less ok, as long as mask was
> provided as "false". This is because it will always use the
> ETHTOOL_A_BITSET_BIT_VALUE section when mask is false. A NOMASK compact
> bitmap will provide this.
> 
> Unfortunately, if the bitset is not sent in the compact format, these
> functions do not behave correctly. When NOMASK is set, then the
> ETHTOOL_A_BITSET_BIT_VALUE is not provided. Instead, the application is
> supposed to treat it as a list of all the valid values.
> 
> Fix these functions so that they behave properly with NOMASK bitsets in
> the non-compact form. Additionally, make these functions report an error
> if requesting to operate with "mask" set on a NOMASK bitmap. This
> ensures that we catch issues in the case where ethtool is trying to
> print the mask of a bitset that has no mask. Doing so highlights a small
> bug in the FEC settings where we accidentally set mask to true. Fix this
> also.
> 
> Reported-by: Jamie Gloudon <jamie.glou...@gmx.fr>
> Signed-off-by: Jacob Keller <jacob.e.kel...@intel.com>

Applied with

  Fixes: 490503bdbd67 ("netlink: add bitset helpers")
  Fixes: 10cc3ea337d1 ("netlink: partial netlink handler for gset (no option)")

Michal

Attachment: signature.asc
Description: PGP signature

Reply via email to