On Mon, Feb 05, 2018 at 07:21:32AM +0100, Heiner Kallweit wrote:
> Recently ethtool started to give incomplete values for supported and
> advertised modes. There seems to be a regression in this commit:
> The bit number parameter in the calls to bitmap_to_arr32() in
> store_link_ksettings_for_user() should be __ETHTOOL_LINK_MODE_MASK_NBITS
> instead of __ETHTOOL_LINK_MODE_MASK_NU32.
> 
> After having changed this ethtool behaves normally again.
> 
> Heiner

Hi Heiner,

Thank you for discovering this, and sorry for my error. 
The patch is below.

Yury

>From af960f7ae1be8e86abfaa39300ba690c24a80e5b Mon Sep 17 00:00:00 2001
From: Yury Norov <yno...@caviumnetworks.com>
Date: Mon, 5 Feb 2018 10:01:59 +0300
Subject: [PATCH] Fix 39461af74125 "bitmap: replace bitmap_{from,to}_u32array"

During rework, bitmap_to_arr32() was erroneously passed with
__ETHTOOL_LINK_MODE_MASK_NU32 instead of __ETHTOOL_LINK_MODE_MASK_NBITS.

Fixes: 39461af74125fd268 (bitmap: replace bitmap_{from,to}_u32array)
Reported-by: Heiner Kallweit <hkallwe...@gmail.com>
Signed-off-by: Yury Norov <yno...@caviumnetworks.com>
---
 net/core/ethtool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 1822335518ea..494e6a5d7306 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -642,13 +642,13 @@ store_link_ksettings_for_user(void __user *to,
        memcpy(&link_usettings.base, &from->base, sizeof(link_usettings));
        bitmap_to_arr32(link_usettings.link_modes.supported,
                        from->link_modes.supported,
-                       __ETHTOOL_LINK_MODE_MASK_NU32);
+                       __ETHTOOL_LINK_MODE_MASK_NBITS);
        bitmap_to_arr32(link_usettings.link_modes.advertising,
                        from->link_modes.advertising,
-                       __ETHTOOL_LINK_MODE_MASK_NU32);
+                       __ETHTOOL_LINK_MODE_MASK_NBITS);
        bitmap_to_arr32(link_usettings.link_modes.lp_advertising,
                        from->link_modes.lp_advertising,
-                       __ETHTOOL_LINK_MODE_MASK_NU32);
+                       __ETHTOOL_LINK_MODE_MASK_NBITS);
 
        if (copy_to_user(to, &link_usettings, sizeof(link_usettings)))
                return -EFAULT;
-- 
2.14.1

Reply via email to