diff mbox

[net-next] ethtool: Set cmd field in ETHTOOL_GLINKSETTINGS response to wrong nwords

Message ID 20160314010537.GD21187@decadent.org.uk
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Ben Hutchings March 14, 2016, 1:05 a.m. UTC
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: 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
Signed-off-by: Ben Hutchings <ben@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(-)

Comments

David Miller March 16, 2016, 11:26 p.m. UTC | #1
From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 14 Mar 2016 01:05:38 +0000

> 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: 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>

Applied and queued up for -stable, thanks Ben.
Ben Hutchings March 16, 2016, 11:36 p.m. UTC | #2
On Wed, 2016-03-16 at 19:26 -0400, David Miller wrote:
> From: Ben Hutchings <ben@decadent.org.uk>
> Date: Mon, 14 Mar 2016 01:05:38 +0000
> 
> > 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: 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> 
> Applied and queued up for -stable, thanks Ben.

This doesn't need fixing in any stable release.

Ben.
David Miller March 17, 2016, 12:16 a.m. UTC | #3
From: Ben Hutchings <ben@decadent.org.uk>
Date: Wed, 16 Mar 2016 23:36:32 +0000

> On Wed, 2016-03-16 at 19:26 -0400, David Miller wrote:
>> From: Ben Hutchings <ben@decadent.org.uk>
>> Date: Mon, 14 Mar 2016 01:05:38 +0000
>> 
>> > 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: 3f1ac7a700d03 ("net: ethtool: add new ETHTOOL_xLINKSETTINGS API")
>> > Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
>> 
>> 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.
diff mbox

Patch

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 2966cd0d7c93..f426c5ad6149 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -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!");