mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: MUNEDA Takahiro <muneda.takahiro@jp.fujitsu.com>
To: Greg KH <greg@kroah.com>, John Rose <johnrose@austin.ibm.com>,
	Jesse Barnes <jbarnes@engr.sgi.com>
Cc: muneda.takahiro@jp.fujitsu.com,
	LKML <linux-kernel@vger.kernel.org>,
	linux-pci <linux-pci@atrey.karlin.mff.cuni.cz>
Subject: [PATCH] PCI: fix pci_remove_legacy_files() crash
Date: Fri, 04 Feb 2005 12:28:36 +0900	[thread overview]
Message-ID: <87zmyl2ecb.wl%muneda.takahiro@jp.fujitsu.com> (raw)

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; }


             reply	other threads:[~2005-02-04  3:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-04  3:28 MUNEDA Takahiro [this message]
2005-02-04 16:45 ` Jesse Barnes
2005-02-08  0:19 ` Greg KH
2005-03-04 20:53 [PATCH] PCI: Make pci_claim_resource __devinit Greg KH
2005-03-04 20:53 ` [PATCH] PCI: fix pci_remove_legacy_files() crash 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=87zmyl2ecb.wl%muneda.takahiro@jp.fujitsu.com \
    --to=muneda.takahiro@jp.fujitsu.com \
    --cc=greg@kroah.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=johnrose@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@atrey.karlin.mff.cuni.cz \
    /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

all inboxes | Powered by JetHome®