[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc1105a3-5d97-9d2f-f3c4-db8e65b69db2@redhat.com>
Date: Thu, 4 May 2017 16:39:25 -0400
From: David Arcari <darcari@...hat.com>
To: Pavel Belous <Pavel.Belous@...antia.com>,
"David S . Miller" <davem@...emloft.net>
Cc: netdev@...r.kernel.org, Lino Sanfilippo <LinoSanfilippo@....de>,
Simon Edelhaus <simon.edelhaus@...antia.com>
Subject: Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
On 05/04/2017 04:10 PM, Pavel Belous wrote:
> From: Pavel Belous <pavel.belous@...antia.com>
>
> 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@...antia.com>
> ---
> drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 6 ++++--
> 1 file 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 cdb0299..9ee1c50 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:;
>
Resolves the ethtool crash.
Tested-by: David Arcari <darcari@...hat.com>
Powered by blists - more mailing lists