linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: fix pci_remove_legacy_files() crash
@ 2005-02-04  3:28 MUNEDA Takahiro
  2005-02-04 16:45 ` Jesse Barnes
  2005-02-08  0:19 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: MUNEDA Takahiro @ 2005-02-04  3:28 UTC (permalink / raw)
  To: Greg KH, John Rose, Jesse Barnes; +Cc: muneda.takahiro, LKML, linux-pci

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: fix pci_remove_legacy_files() crash
  2005-02-04  3:28 [PATCH] PCI: fix pci_remove_legacy_files() crash MUNEDA Takahiro
@ 2005-02-04 16:45 ` Jesse Barnes
  2005-02-08  0:19 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Jesse Barnes @ 2005-02-04 16:45 UTC (permalink / raw)
  To: MUNEDA Takahiro; +Cc: Greg KH, John Rose, LKML, linux-pci

On Thursday, February 3, 2005 7:28 pm, MUNEDA Takahiro wrote:
> 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;
> }

Thanks, though the case where b->legacy_io is NULL should be very rare (it'll 
only happen if the initialization can't get memory for b->legacy_io), it's 
still a possibility so this fix is needed.

Acked-by: Jesse Barnes <jbarnes@sgi.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] PCI: fix pci_remove_legacy_files() crash
  2005-02-04  3:28 [PATCH] PCI: fix pci_remove_legacy_files() crash MUNEDA Takahiro
  2005-02-04 16:45 ` Jesse Barnes
@ 2005-02-08  0:19 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Greg KH @ 2005-02-08  0:19 UTC (permalink / raw)
  To: MUNEDA Takahiro; +Cc: John Rose, Jesse Barnes, LKML, linux-pci

On Fri, Feb 04, 2005 at 12:28:36PM +0900, MUNEDA Takahiro wrote:
> 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>

Applied, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] PCI: fix pci_remove_legacy_files() crash
  2005-03-04 20:53 [PATCH] PCI: Make pci_claim_resource __devinit Greg KH
@ 2005-03-04 20:53 ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2005-03-04 20:53 UTC (permalink / raw)
  To: linux-kernel, linux-pci; +Cc: muneda.takahiro

ChangeSet 1.1998.11.11, 2005/02/07 16:20:26-08:00, muneda.takahiro@jp.fujitsu.com

[PATCH] PCI: fix pci_remove_legacy_files() crash

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>
Acked-by: Jesse Barnes <jbarnes@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


 drivers/pci/probe.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)


diff -Nru a/drivers/pci/probe.c b/drivers/pci/probe.c
--- a/drivers/pci/probe.c	2005-03-04 12:42:59 -08:00
+++ b/drivers/pci/probe.c	2005-03-04 12:42:59 -08:00
@@ -64,9 +64,11 @@
 
 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; }


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-03-04 23:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-04  3:28 [PATCH] PCI: fix pci_remove_legacy_files() crash MUNEDA Takahiro
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).