[PATCH] PCI: fix pci_remove_legacy_files() crash
From: MUNEDA Takahiro (muneda.takahiro_at_jp.fujitsu.com)
Date: 02/04/05
- Previous message: Bartlomiej Zolnierkiewicz: "[patch 2/9] drive->nice1 fix"
- Next in thread: Jesse Barnes: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Reply: Jesse Barnes: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Reply: Greg KH: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 04 Feb 2005 12:28:36 +0900 To: Greg KH <greg@kroah.com>, John Rose <johnrose@austin.ibm.com>, Jesse Barnes <jbarnes@engr.sgi.com>
Hi,
The legacy_io which is the member of pci_bus struct might be
NULL. It should be checked.
This patch checks 'b->legacy_io', NULL or not.
Signed-off-by: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
---
probe.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff -Npur a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c 2005-01-31 13:31:27.000000000 +0900
+++ b/drivers/pci/probe.c 2005-02-03 11:21:51.000000000 +0900
@@ -64,9 +64,11 @@ static void pci_create_legacy_files(stru
void pci_remove_legacy_files(struct pci_bus *b)
{
- class_device_remove_bin_file(&b->class_dev, b->legacy_io);
- class_device_remove_bin_file(&b->class_dev, b->legacy_mem);
- kfree(b->legacy_io); /* both are allocated here */
+ if (b->legacy_io) {
+ class_device_remove_bin_file(&b->class_dev, b->legacy_io);
+ class_device_remove_bin_file(&b->class_dev, b->legacy_mem);
+ kfree(b->legacy_io); /* both are allocated here */
+ }
}
#else /* !HAVE_PCI_LEGACY */
static inline void pci_create_legacy_files(struct pci_bus *bus) { return; }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Bartlomiej Zolnierkiewicz: "[patch 2/9] drive->nice1 fix"
- Next in thread: Jesse Barnes: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Reply: Jesse Barnes: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Reply: Greg KH: "Re: [PATCH] PCI: fix pci_remove_legacy_files() crash"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|