From: Andrew Morton <akpm@osdl.org>
To: yanmin_zhang@linux.intel.com, greg@kroah.com,
linux-kernel@vger.kernel.org
Subject: Re: pci_walk_bus race condition
Date: Thu, 1 Jun 2006 22:24:02 -0700 [thread overview]
Message-ID: <20060601222402.f2d427b4.akpm@osdl.org> (raw)
In-Reply-To: <20060601221141.d84bcf97.akpm@osdl.org>
On Thu, 1 Jun 2006 22:11:41 -0700
Andrew Morton <akpm@osdl.org> wrote:
> On Fri, 02 Jun 2006 12:35:43 +0800
> "Zhang, Yanmin" <yanmin_zhang@linux.intel.com> wrote:
>
> > pci_walk_bus has a race with pci_destroy_dev. When cb is called
> > in pci_walk_bus, pci_destroy_dev might unlink the dev pointed by next.
> > Later on in the next loop, pointer next becomes NULL and cause
> > kernel panic.
> >
> > Below patch against 2.6.17-rc4 fixes it by changing pci_bus_lock (spin_lock)
> > to pci_bus_sem (rw_semaphore).
>
> How does s/spinlock/rwsem/ fix a race??
oic. "and hold the lock across the callback".
Is the ranking of pci_bus_sem and dev->dev.sem correct+consistent? It
looks OK.
It might be worth making a not that the callback function cannot call any
PCI layer function which takes pci_bus_sem - that'll casue a recursive
down_read(), which is a nasty source of rare deadlocks.
next prev parent reply other threads:[~2006-06-02 5:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-26 6:35 Zhang, Yanmin
2006-05-26 13:50 ` Greg KH
2006-05-29 0:41 ` Zhang, Yanmin
2006-05-29 8:05 ` Zhang, Yanmin
2006-06-02 4:35 ` Zhang, Yanmin
2006-06-02 5:11 ` Andrew Morton
2006-06-02 5:24 ` Andrew Morton [this message]
2006-06-02 10:51 ` Zhang, Yanmin
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=20060601222402.f2d427b4.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yanmin_zhang@linux.intel.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
all inboxes | Powered by JetHome®