All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: den@openvz.org, dev@openvz.org, akpm@linux-foundation.org,
	gregkh@suse.de
Cc: devel@openvz.org, linux-kernel@vger.kernel.org, xemul@openvz.org
Subject: [PATCH] pci_get_device call from interrupt in reboot fixups
Date: Tue, 7 Aug 2007 13:04:47 +0400	[thread overview]
Message-ID: <20070807090447.GA14294@iris.sw.ru> (raw)

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

--- ./arch/i386/kernel/reboot_fixups.c.fixup2	2007-08-07 12:30:30.000000000 +0400
+++ ./arch/i386/kernel/reboot_fixups.c	2007-08-07 12:31:22.000000000 +0400
@@ -11,6 +11,7 @@
 #include <asm/delay.h>
 #include <linux/pci.h>
 #include <linux/reboot_fixups.h>
+#include <linux/interrupt.h>
 
 static void cs5530a_warm_reset(struct pci_dev *dev)
 {
@@ -43,6 +44,11 @@ void mach_reboot_fixups(void)
 	struct pci_dev *dev;
 	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++) {
 		cur = &(fixups_table[i]);
 		dev = pci_get_device(cur->vendor, cur->device, NULL);

             reply	other threads:[~2007-08-07  9:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-07  9:04 Denis V. Lunev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2007-08-03 10:39 [PATCH] pci_get_device call from interrupt in reboot fixups Denis V. Lunev
2007-08-04  4:08 ` Greg KH
2007-08-06  7:16   ` Denis V. Lunev
2007-08-07  2:49     ` Greg KH
2007-08-07  7:24       ` Andrew Morton
2007-08-07  7:44         ` Andrew Morton
2007-08-07  7:42           ` Greg KH
2007-08-07  7:50             ` Denis V. Lunev
2007-08-07  7:48         ` Denis V. Lunev
2007-08-06 20:03 ` Andrew Morton

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=20070807090447.GA14294@iris.sw.ru \
    --to=den@openvz.org \
    --cc=akpm@linux-foundation.org \
    --cc=dev@openvz.org \
    --cc=devel@openvz.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xemul@openvz.org \
    /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.