diff options
author | Pavel Belous <pavel.belous@aquantia.com> | 2017-05-04 23:10:56 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-08 12:53:12 -0400 |
commit | 3013c4983eb15f4ce8958e81922cdfd80f771d3e (patch) | |
tree | d2eb1ac976efbc325b45480cff63d7196c6a1bce /drivers/net/ethernet/aquantia | |
parent | 2c041afc5af93a47b8bae2b1190a7b6ed028b706 (diff) | |
download | linux-3013c4983eb15f4ce8958e81922cdfd80f771d3e.tar.bz2 |
aquantia: Fix "ethtool -S" crash when adapter down.
This patch fixes the crash that happens when driver tries to collect statistics
from already released "aq_vec" object.
If adapter is in "down" state we still allow user to see statistics from HW.
V2: fixed braces around "aq_vec_free".
Fixes: 97bde5c4f909 ("net: ethernet: aquantia: Support for NIC-specific code")
Signed-off-by: Pavel Belous <pavel.belous@aquantia.com>
Tested-by: David Arcari <darcari@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia')
-rw-r--r-- | drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c index cdb02991f249..9ee1c5016784 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c @@ -755,7 +755,7 @@ void aq_nic_get_stats(struct aq_nic_s *self, u64 *data) count = 0U; for (i = 0U, aq_vec = self->aq_vec[0]; - self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) { + aq_vec && self->aq_vecs > i; ++i, aq_vec = self->aq_vec[i]) { data += count; aq_vec_get_sw_stats(aq_vec, data, &count); } @@ -959,8 +959,10 @@ void aq_nic_free_hot_resources(struct aq_nic_s *self) goto err_exit; for (i = AQ_DIMOF(self->aq_vec); i--;) { - if (self->aq_vec[i]) + if (self->aq_vec[i]) { aq_vec_free(self->aq_vec[i]); + self->aq_vec[i] = NULL; + } } err_exit:; |