netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: fleitner@redhat.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] niu: fix SMP race protecting rx_rings and tx_rings
Date: Thu, 03 Feb 2011 14:21:45 -0800 (PST)	[thread overview]
Message-ID: <20110203.142145.183054407.davem@davemloft.net> (raw)
In-Reply-To: <1296758717-18406-1-git-send-email-fleitner@redhat.com>

From: Flavio Leitner <fleitner@redhat.com>
Date: Thu,  3 Feb 2011 16:45:17 -0200

> It's possible to trigger a crash if one CPU is opening
> the device while another CPU gets its statistics.
> 
> It happens because niu_alloc_channels() called from
> niu_open() sets num_tx/rx_rings before allocating the
> ring, so the other thread crashes when accessing
> np->tx_rings[i].tx_packets at niu_get_tx_stats().
> 
> Signed-off-by: Flavio Leitner <fleitner@redhat.com>
 ...
> Compile tested only because I don't have the hardware.

I'll apply this and give it a quick test, thanks.

Can you have the person who reported this crash to you test the patch
out at least?  That's how you learned about this problem, right,
someone else hit the crash?

In such cases I'd really appreciate it if you got positive testing
feedback from the reporter before posting the patch.

Longer term a better way to fix this is to RCU free the ring data
structures, and use a quick NULL test at the top of the get stats
implementation.


  reply	other threads:[~2011-02-03 22:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-03 18:45 [PATCH] niu: fix SMP race protecting rx_rings and tx_rings Flavio Leitner
2011-02-03 22:21 ` David Miller [this message]
2011-02-03 23:18   ` Flavio Leitner
2011-02-03 23:22     ` David Miller
2011-02-03 23:47       ` Flavio Leitner
2011-02-03 23:53         ` David Miller

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=20110203.142145.183054407.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=fleitner@redhat.com \
    --cc=netdev@vger.kernel.org \
    /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).