PCI: pci_get_device call from interrupt in reboot fixups

The following calltrace is possible now:
 handle_sysrq
   machine_emergency_restart
     mach_reboot_fixups
       pci_get_device
         pci_get_subsys
	   down_read
The patch skips reboot fixup if called from sysrq-B code.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Denis V. Lunev 2007-08-07 13:13:18 +04:00 committed by Greg Kroah-Hartman
parent aa24886e37
commit 3d034aecd8
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include <asm/delay.h> #include <asm/delay.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/interrupt.h>
#include <asm/reboot_fixups.h> #include <asm/reboot_fixups.h>
#include <asm/msr.h> #include <asm/msr.h>
@ -56,6 +57,11 @@ void mach_reboot_fixups(void)
struct pci_dev *dev; struct pci_dev *dev;
int i; int i;
/* we can be called from sysrq-B code. In such a case it is
* prohibited to dig PCI */
if (in_interrupt())
return;
for (i=0; i < ARRAY_SIZE(fixups_table); i++) { for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
cur = &(fixups_table[i]); cur = &(fixups_table[i]);
dev = pci_get_device(cur->vendor, cur->device, NULL); dev = pci_get_device(cur->vendor, cur->device, NULL);