ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords
Subsystems (3)
PATCH 1/1 ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords
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.
---
David, please can you include this in changes for 4.6?
Ben.
net/core/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/ethtool.c +1 -1
@@ -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!" );
Quoted 24 lines · Ben Hutchings <ben <at> decadent.org.uk> writes:
When the
ETHTOOL_GLINKSETTINGSimplementation 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 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")Signed-off-by Ben Hutchings <ben <at> decadent.org.uk>---
David, please can you include this in changes for 4.6?Ben.
net/core/ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)net/core/ethtool.c +0
-0
net/core/ethtool.c
Quoted 1 line
net/core/ethtool.c +0
-0<at> <at> -655,7 +655,7 <at> <at> static int
ethtool_get_link_ksettings(struct net_device *dev,
net/core/ethtool.c
Quoted 9 lines
net/core/ethtool.c +1
-1!= 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!" );
thanks!
Please also update the comments in ethtool.h, proposed change below:
include/uapi/linux/ethtool.h +3 -3
@@ -1648,9 +1648,9 @@ enum ethtool_reset_flags {* %ETHTOOL_GLINKSETTINGS: on entry, number of words passed by user * (>= 0); on return, if handshake in progress, negative if * request size unsupported by kernel: absolute value indicates -* kernel recommended size and cmd field is 0, as well as all the -* other fields; otherwise (handshake completed), strictly -* positive to indicate size used by kernel and cmd field is +* kernel expected size and all the other fields but cmd +* are 0; otherwise (handshake completed), strictly positive +* to indicate size used by kernel and cmd field stays * %ETHTOOL_GLINKSETTINGS, all other fields populated by driver. For * %ETHTOOL_SLINKSETTINGS: must be valid on entry, ie. a positive * value returned previously by %ETHTOOL_GLINKSETTINGS, otherwise
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Mon, 14 Mar 2016 01:05:38 +0000
Quoted 11 lines
When the
ETHTOOL_GLINKSETTINGSimplementation 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 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")Signed-off-by Ben Hutchings <[email protected]>
Applied and queued up for -stable, thanks Ben.
Quoted 15 lines · David Miller
From: Ben Hutchings <[email protected]>
Date: Mon, 14 Mar 2016 01:05:38 +0000Quoted 11 lines
When the
ETHTOOL_GLINKSETTINGSimplementation 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 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")Signed-off-by Ben Hutchings <[email protected]>
Quoted 1 line
Applied and queued up for -stable, thanks Ben.
This doesn't need fixing in any stable release.
Ben.
Signature · 2 lines
Ben Hutchings If you seem to know what you are doing, you'll be given more to do.
David Miller
maintainerFrom: Ben Hutchings <[email protected]>
Date: Wed, 16 Mar 2016 23:36:32 +0000
Quoted 16 lines · David Miller
Quoted 15 lines
From: Ben Hutchings <[email protected]>
Date: Mon, 14 Mar 2016 01:05:38 +0000Quoted 11 lines
When the
ETHTOOL_GLINKSETTINGSimplementation 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 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")Signed-off-by Ben Hutchings <[email protected]>
Quoted 3 lines
Quoted 1 line
Applied and queued up for -stable, thanks Ben.
This doesn't need fixing in any stable release.
My bad I thought it was needed for 4.5-final.