From: David Arcari <darcari@redhat.com>
To: Pavel Belous <Pavel.Belous@aquantia.com>,
"David S . Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Lino Sanfilippo <LinoSanfilippo@gmx.de>,
Simon Edelhaus <simon.edelhaus@aquantia.com>
Subject: Re: [PATCH] aquantia: Fix "ethtool -S" crash when adapter down.
Date: Thu, 4 May 2017 16:39:25 -0400 [thread overview]
Message-ID: <fc1105a3-5d97-9d2f-f3c4-db8e65b69db2@redhat.com> (raw)
In-Reply-To: <9ea5a2ba21b4f8b22a63acf39135a41e2f1da23c.1493928470.git.pavel.belous@aquantia.com>
On 05/04/2017 04:10 PM, Pavel Belous wrote:
> From: Pavel Belous <pavel.belous@aquantia.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@aquantia.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@redhat.com>
next prev parent reply other threads:[~2017-05-04 20:39 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 20:10 [PATCH] aquantia: Fix "ethtool -S" crash when adapter down Pavel Belous
2017-05-04 20:30 ` Joe Perches
2017-05-04 20:39 ` David Arcari [this message]
2017-05-08 16:53 ` David Miller
-- strict thread matches above, loose matches on Subject: below --
2017-05-04 16:33 Pavel Belous
2017-05-04 16:48 ` Lino Sanfilippo
2017-05-04 16:51 ` David Miller
2017-05-04 17:09 ` Pavel Belous
2017-05-04 18:27 ` David Arcari
2017-05-04 18:37 ` Pavel Belous
2017-05-04 19:08 ` Lino Sanfilippo
2017-05-04 17:00 ` David Arcari
2017-05-04 17:08 ` Pavel Belous
2017-05-04 18:17 ` Joe Perches
2017-05-04 18:41 ` Pavel Belous
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fc1105a3-5d97-9d2f-f3c4-db8e65b69db2@redhat.com \
--to=darcari@redhat.com \
--cc=LinoSanfilippo@gmx.de \
--cc=Pavel.Belous@aquantia.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
--cc=simon.edelhaus@aquantia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).