All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Stanislaw Gruszka <stf_xl@wp.pl>
Cc: netdev@vger.kernel.org, Mirko Lindner <mlindner@marvell.com>
Subject: Re: [PATCH] sky2: initialize napi before registering device
Date: Sat, 25 Jan 2014 17:01:20 -0800	[thread overview]
Message-ID: <20140125170120.2e78cdb4@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <20140125103454.GA2490@localhost.localdomain>

On Sat, 25 Jan 2014 11:34:54 +0100
Stanislaw Gruszka <stf_xl@wp.pl> wrote:

> There is race condition when call netif_napi_add() after
> register_netdevice(), as ->open() can be called without napi initialized
> and trigger BUG_ON() on napi_enable(), like on below messages:
> 
> [    9.699863] sky2: driver version 1.30
> [    9.699960] sky2 0000:02:00.0: Yukon-2 EC Ultra chip revision 2
> [    9.700020] sky2 0000:02:00.0: irq 45 for MSI/MSI-X
> [    9.700498] ------------[ cut here ]------------
> [    9.703391] kernel BUG at include/linux/netdevice.h:501!
> [    9.703391] invalid opcode: 0000 [#1] PREEMPT SMP
> <snip>
> [    9.830018] Call Trace:
> [    9.830018]  [<fa996169>] sky2_open+0x309/0x360 [sky2]
> [    9.830018]  [<c1007210>] ? via_no_dac+0x40/0x40
> [    9.830018]  [<c1007210>] ? via_no_dac+0x40/0x40
> [    9.830018]  [<c135ed4b>] __dev_open+0x9b/0x120
> [    9.830018]  [<c1431cbe>] ? _raw_spin_unlock_bh+0x1e/0x20
> [    9.830018]  [<c135efd9>] __dev_change_flags+0x89/0x150
> [    9.830018]  [<c135f148>] dev_change_flags+0x18/0x50
> [    9.830018]  [<c13bb8e0>] devinet_ioctl+0x5d0/0x6e0
> [    9.830018]  [<c13bcced>] inet_ioctl+0x6d/0xa0
> 
> To fix the problem patch changes the order of initialization.
> 
> Bug report:
> https://bugzilla.kernel.org/show_bug.cgi?id=67151
> 
> Reported-and-tested-by: ebrahim.azarisooreh@gmail.com
> Signed-off-by: Stanislaw Gruszka <stf_xl@wp.pl>

That looks good, problem was introduced years ago.
I wonder if netif_napi_del() should be in unwind if registration
of either devices fails?

  reply	other threads:[~2014-01-26  1:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-25 10:34 [PATCH] sky2: initialize napi before registering device Stanislaw Gruszka
2014-01-26  1:01 ` Stephen Hemminger [this message]
2014-01-27 11:53   ` Stanislaw Gruszka
2014-01-28  0:40 ` 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=20140125170120.2e78cdb4@nehalam.linuxnetplumber.net \
    --to=stephen@networkplumber.org \
    --cc=mlindner@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=stf_xl@wp.pl \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.