• Ivan Vecera's avatar
    bna: fix crash in bnad_get_strings() · 37dd3482
    Ivan Vecera authored
    Commit 6e7333d3 "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: 6e7333d3 "net: add rx_nohandler stat counter"
    Signed-off-by: default avatarIvan Vecera <ivecera@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    37dd3482
bnad_ethtool.c 29.4 KB