e1000e: Don't return uninitialized stats
authorBenjamin Poirier <bpoirier@suse.com>
Wed, 17 May 2017 20:24:13 +0000 (16:24 -0400)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 6 Jun 2017 08:05:13 +0000 (01:05 -0700)
Some statistics passed to ethtool are garbage because e1000e_get_stats64()
doesn't write them, for example: tx_heartbeat_errors. This leaks kernel
memory to userspace and confuses users.

Do like ixgbe and use dev_get_stats() which first zeroes out
rtnl_link_stats64.

Fixes: 5944701df90d ("net: remove useless memset's in drivers get_stats64")
Reported-by: Stefan Priebe <s.priebe@profihost.ag>
Signed-off-by: Benjamin Poirier <bpoirier@suse.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/e1000e/ethtool.c

index c658f6ebf7cb4d0a1d205782aac68f7088c0b5de..003cbd6057990050dd3bda971b9ad77ee6c5e17e 100644 (file)
@@ -2073,7 +2073,7 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
 
        pm_runtime_get_sync(netdev->dev.parent);
 
-       e1000e_get_stats64(netdev, &net_stats);
+       dev_get_stats(netdev, &net_stats);
 
        pm_runtime_put_sync(netdev->dev.parent);