]> git.itanic.dy.fi Git - linux-stable/commit
[PATCH] PCI: prevent down_read when pci_devices is empty
authorArd van Breemen <ard@telegraafnet.nl>
Sat, 6 Jan 2007 00:36:21 +0000 (16:36 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 6 Jan 2007 07:55:21 +0000 (23:55 -0800)
commit6ae4adf50380d0fc5176a76d98d324f8fa491a8f
tree60607373a28073ce654e030545767e7c1062b98e
parenta416aba637dcb4127595c02a59041cd278422f7e
[PATCH] PCI: prevent down_read when pci_devices is empty

The pci_find_subsys gets called very early by obsolete ide setup parameters.
This is a bogus call since pci is not initialized yet, so the list is empty.
But in the mean time, interrupts get enabled by down_read.  This can result in
a kernel panic when the irq controller gets initialized.

This patch checks if the device list is empty before taking the semaphore, and
hence will not enable irq's.  Furthermore it will inform that it is called
while pci_devices is empty as a reminder that the ide code needs to be fixed.

The pci_get_subsys can get called in the same manner, and as such is patched
in the same manner.

[akpm@osdl.org: cleanups]
Signed-off-by: Ard van Breemen <ard@telegraafnet.nl>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/pci/search.c