Patrick McHardy <ka...@trash.net> writes:
> On Thu, May 02, 2013 at 04:16:25AM -0400, David Miller wrote:
>> From: Patrick McHardy <ka...@trash.net>
>> Date: Thu, 2 May 2013 09:03:37 +0200
>> 
>> > I'll also have a look at this.
>> 
>> By the mere existence of /sys/devices/${DEV_PATH}/net/${netdev_name}/flags
>> we have to preserve the bit layout.
>> 
>> So Linus was right.
>> 
>> So network manager is probably reading that flags sysfs file and
>> interpreting it.
>
> Right, that seems plausible. 
>
>> I'll fix the layout to how it was before.
>
> I also found one spot in net/core/dev.c which was using an int for the
> features. Patch attached.

And a couple more attached.

I am also wondering about the consequences of the
ETHTOOL_DEV_FEATURE_WORDS calculation in ethtool.c.  Adding the new
netdev features will make it go from 1 to 2:

#define ETHTOOL_DEV_FEATURE_WORDS       ((NETDEV_FEATURE_COUNT + 31) / 32)


But this constant seems to be part of the userspace API AFAICS, so it
cannot just change like that:

static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
{
        struct ethtool_sfeatures cmd;
        struct ethtool_set_features_block features[ETHTOOL_DEV_FEATURE_WORDS];
        netdev_features_t wanted = 0, valid = 0;
        int i, ret = 0;

        if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
                return -EFAULT;
        useraddr += sizeof(cmd);

        if (cmd.size != ETHTOOL_DEV_FEATURE_WORDS)
                return -EINVAL;

..


Is this correctly analyzed?  If so, then I have no clue how to fix
that...



Bjørn


>From d957cf339bf625869c39d852ac6733ef597ecef9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <bj...@mork.no>
Date: Thu, 2 May 2013 10:37:05 +0200
Subject: [PATCH] net: vlan,ethtool: netdev_features_t is more than 32 bit
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Bjørn Mork <bj...@mork.no>
---
 net/8021q/vlan_dev.c |    2 +-
 net/core/ethtool.c   |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8af5085..3a8c8fd 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -628,7 +628,7 @@ static netdev_features_t vlan_dev_fix_features(struct net_device *dev,
 	netdev_features_t features)
 {
 	struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
-	u32 old_features = features;
+	netdev_features_t old_features = features;
 
 	features &= real_dev->vlan_features;
 	features |= NETIF_F_RXCSUM;
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 5a934ef..22efdaa 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -1421,7 +1421,7 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 	void __user *useraddr = ifr->ifr_data;
 	u32 ethcmd;
 	int rc;
-	u32 old_features;
+	netdev_features_t old_features;
 
 	if (!dev || !netif_device_present(dev))
 		return -ENODEV;
-- 
1.7.10.4

Reply via email to