Skip to content

Commit

Permalink
ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords
Browse files Browse the repository at this point in the history
When the ETHTOOL_GLINKSETTINGS implementation finds that userland is
using the wrong number of words of link mode bitmaps (or is trying to
find out the right numbers) it sets the cmd field to 0 in the response
structure.

This is inconsistent with the implementation of every other ethtool
command, so let's remove that inconsistency before it gets into a
stable release.

Fixes: 3f1ac7a ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Ben Hutchings authored and David S. Miller committed Mar 16, 2016
1 parent ad846aa commit 793cf87
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/core/ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ static int ethtool_get_link_ksettings(struct net_device *dev,
!= link_ksettings.base.link_mode_masks_nwords) {
/* wrong link mode nbits requested */
memset(&link_ksettings, 0, sizeof(link_ksettings));
/* keep cmd field reset to 0 */
link_ksettings.base.cmd = ETHTOOL_GLINKSETTINGS;
/* send back number of words required as negative val */
compiletime_assert(__ETHTOOL_LINK_MODE_MASK_NU32 <= S8_MAX,
"need too many bits for link modes!");
Expand Down

0 comments on commit 793cf87

Please sign in to comment.