[PATCH] PCI: fix race with pci_walk_bus and pci_destroy_dev
authorZhang Yanmin <yanmin.zhang@intel.com>
Fri, 2 Jun 2006 04:35:43 +0000 (12:35 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 21 Jun 2006 19:00:01 +0000 (12:00 -0700)
commitd71374dafbba7ec3f67371d3b7e9f6310a588808
tree116dcd65fde3701d10fea954cdbd5bb063182b2c
parent733a7fe12248072e1bca729c88a26298666f1956
[PATCH] PCI: fix race with pci_walk_bus and pci_destroy_dev

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).

Signed-off-by: Zhang Yanmin <yanmin.zhang@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/bus.c
drivers/pci/pci.h
drivers/pci/probe.c
drivers/pci/remove.c
drivers/pci/search.c