bna: fix crash in bnad_get_strings()
authorIvan Vecera <ivecera@redhat.com>
Thu, 15 Sep 2016 20:47:52 +0000 (22:47 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Sep 2016 14:18:02 +0000 (10:18 -0400)
commit37dd348270c1a48f0234354a06c0ce052b6c85b1
treefa6a649dcac23bdcc511fc41413ae9a5ef9e0a16
parent2835d2d9e366a2985b24051d228333bfba82f3a7
bna: fix crash in bnad_get_strings()

Commit 6e7333d "net: add rx_nohandler stat counter" added the new entry
rx_nohandler into struct rtnl_link_stats64. Unfortunately the bna
driver foolishly depends on the structure. It uses part of it for
ethtool statistics and it's not bad but the driver assumes its size
is constant as it defines string for each existing entry. The problem
occurs when the structure is extended because you need to modify bna
driver as well. If not any attempt to retrieve ethtool statistics results
in crash in bnad_get_strings().
The patch changes BNAD_ETHTOOL_STATS_NUM so it counts real number of
strings in the array and also removes rtnl_link_stats64 entries that
are not used in output and are always zero.

Fixes: 6e7333d "net: add rx_nohandler stat counter"
Signed-off-by: Ivan Vecera <ivecera@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/brocade/bna/bnad_ethtool.c