Re: [PATCH net] net: hns: fix ethtool_get_strings overflow in hns driver

2017-04-28 Thread David Miller
From: Timmy Li Date: Thu, 27 Apr 2017 22:18:16 +0800 > @@ -672,7 +672,7 @@ static void hns_gmac_get_strings(u32 stringset, u8 *data) > > static int hns_gmac_get_sset_count(int stringset) > { > - if (stringset == ETH_SS_STATS) > + if ((stringset == ETH_SS_STATS) || (stringset == ETH_SS

[PATCH net] net: hns: fix ethtool_get_strings overflow in hns driver

2017-04-27 Thread Timmy Li
hns_get_sset_count() returns HNS_NET_STATS_CNT and the data space allocated is not enough for ethtool_get_strings(), which will cause random memory corruption. When SLAB and DEBUG_SLAB are both enabled, memory corruptions like the the following can be observed without this patch: [ 43.115200] Sl