]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit7522cb4502e7903e2e5f885e59dd0575befeaf15
treefa6a649dcac23bdcc511fc41413ae9a5ef9e0a16
parentf6e93f4aab4983a49079a47fbf7a3b0235f70a94
bna: fix crash in bnad_get_strings()

Commit fc2ce5e "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: fc2ce5e "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