public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] More PCI fixes for 2.6.7
Date: Fri, 2 Jul 2004 14:39:12 -0700	[thread overview]
Message-ID: <1088804352811@kroah.com> (raw)
In-Reply-To: <10888043523764@kroah.com>

ChangeSet 1.1787, 2004/07/02 13:33:23-07:00, linas@austin.ibm.com

[PATCH] PCI Hotplug: rpaphp null pointer deref

This patch fixes a null-pointer dereference when hot-plug operations
are performed on a machine that has virtual-io devices in it.
Virtual i/o devices to not have pci bridges associated with them.
It also corrects an ordering problem during hotplug remove.

This patch was previously reviewed/tested by Linda Xie, the current
rpaphp maintainer.

Signed-off-by: Linas Vepstas <linas@linas.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/pci/hotplug/rpaphp_pci.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)


diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
--- a/drivers/pci/hotplug/rpaphp_pci.c	2004-07-02 14:24:33 -07:00
+++ b/drivers/pci/hotplug/rpaphp_pci.c	2004-07-02 14:24:33 -07:00
@@ -378,8 +378,8 @@
 	
 		func = list_entry(ln, struct rpaphp_pci_func, sibling);
 		if (func->pci_dev) {
-			rpaphp_eeh_remove_bus_device(func->pci_dev);
 			pci_remove_bus_device(func->pci_dev); 
+			rpaphp_eeh_remove_bus_device(func->pci_dev);
 		}
 		kfree(func);
 	}
@@ -513,9 +513,18 @@
 		struct list_head *ln;
 
 		slot = list_entry(tmp, struct slot, rpaphp_slot_list);
+		if (slot->bridge == NULL) {
+			if (slot->dev_type == PCI_DEV) {
+				printk(KERN_WARNING "PCI slot missing bridge %s %s \n", 
+				                    slot->name, slot->location);
+			}
+			continue;
+		}
+
 		bus = slot->bridge->subordinate;
-		if (!bus)
-			return NULL; /* shouldn't be here */
+		if (!bus) {
+			continue;  /* should never happen? */
+		}
 		for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
                                 struct pci_dev *pdev = pci_dev_b(ln);
 				if (pdev == dev)


  reply	other threads:[~2004-07-02 21:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-02 21:38 [BK PATCH] More PCI fixes for 2.6.7 Greg KH
2004-07-02 21:39 ` [PATCH] " Greg KH
2004-07-02 21:39   ` Greg KH
2004-07-02 21:39     ` Greg KH [this message]
2004-07-02 21:39       ` Greg KH
2004-07-02 21:39         ` Greg KH

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=1088804352811@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox