* [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-17 12:03 ` Mikulas Patocka
0 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 12:03 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
Hi
When you compile kernel on Sparc64 with heap memory checking and type
"cat /proc/iomem", you get a crash, because pointers in struct resource
are uninitialized.
Most code fills struct resource with zeros, so I assume that it is
responsibility of the caller of request_resource to initialized it, not
the responsibility of request_resource functuion.
After 2.6.29 is out, there could be a check for uninitialized fields added
to request_resource to avoid crashes like this.
Mikulas
---
arch/sparc/kernel/pci_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
===================================================================
--- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
+++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
@@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
if (vdma) {
- struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
+ struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
if (!rp) {
prom_printf("Cannot allocate IOMMU resource.\n");
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-17 12:03 ` Mikulas Patocka
0 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 12:03 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
Hi
When you compile kernel on Sparc64 with heap memory checking and type
"cat /proc/iomem", you get a crash, because pointers in struct resource
are uninitialized.
Most code fills struct resource with zeros, so I assume that it is
responsibility of the caller of request_resource to initialized it, not
the responsibility of request_resource functuion.
After 2.6.29 is out, there could be a check for uninitialized fields added
to request_resource to avoid crashes like this.
Mikulas
---
arch/sparc/kernel/pci_common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
=================================--- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
+++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
@@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
if (vdma) {
- struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
+ struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
if (!rp) {
prom_printf("Cannot allocate IOMMU resource.\n");
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
2009-03-17 12:03 ` Mikulas Patocka
@ 2009-03-17 12:08 ` Mikulas Patocka
-1 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 12:08 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
On Tue, 17 Mar 2009, Mikulas Patocka wrote:
> Hi
>
> When you compile kernel on Sparc64 with heap memory checking and type
> "cat /proc/iomem", you get a crash, because pointers in struct resource
> are uninitialized.
>
> Most code fills struct resource with zeros, so I assume that it is
> responsibility of the caller of request_resource to initialized it, not
> the responsibility of request_resource functuion.
>
> After 2.6.29 is out, there could be a check for uninitialized fields added
> to request_resource to avoid crashes like this.
>
> Mikulas
I forgot to add:
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> ---
> arch/sparc/kernel/pci_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
> ===================================================================
> --- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
> +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
> @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
> const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
>
> if (vdma) {
> - struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
> + struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
>
> if (!rp) {
> prom_printf("Cannot allocate IOMMU resource.\n");
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-17 12:08 ` Mikulas Patocka
0 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 12:08 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
On Tue, 17 Mar 2009, Mikulas Patocka wrote:
> Hi
>
> When you compile kernel on Sparc64 with heap memory checking and type
> "cat /proc/iomem", you get a crash, because pointers in struct resource
> are uninitialized.
>
> Most code fills struct resource with zeros, so I assume that it is
> responsibility of the caller of request_resource to initialized it, not
> the responsibility of request_resource functuion.
>
> After 2.6.29 is out, there could be a check for uninitialized fields added
> to request_resource to avoid crashes like this.
>
> Mikulas
I forgot to add:
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> ---
> arch/sparc/kernel/pci_common.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
> =================================> --- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
> +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
> @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
> const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
>
> if (vdma) {
> - struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
> + struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
>
> if (!rp) {
> prom_printf("Cannot allocate IOMMU resource.\n");
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
2009-03-17 12:08 ` Mikulas Patocka
@ 2009-03-17 13:35 ` Mikulas Patocka
-1 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 13:35 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
>
> On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
> > Hi
> >
> > When you compile kernel on Sparc64 with heap memory checking and type
> > "cat /proc/iomem", you get a crash, because pointers in struct resource
> > are uninitialized.
> >
> > Most code fills struct resource with zeros, so I assume that it is
> > responsibility of the caller of request_resource to initialized it, not
> > the responsibility of request_resource functuion.
> >
> > After 2.6.29 is out, there could be a check for uninitialized fields added
> > to request_resource to avoid crashes like this.
> >
> > Mikulas
>
> I forgot to add:
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
... and
Cc: stable@kernel.org
because it applies to old kernels as well, even 2.6.26 crashes.
Mikulas
> > ---
> > arch/sparc/kernel/pci_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
> > ===================================================================
> > --- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
> > +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
> > @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
> > const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
> >
> > if (vdma) {
> > - struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
> > + struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
> >
> > if (!rp) {
> > prom_printf("Cannot allocate IOMMU resource.\n");
> >
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-17 13:35 ` Mikulas Patocka
0 siblings, 0 replies; 10+ messages in thread
From: Mikulas Patocka @ 2009-03-17 13:35 UTC (permalink / raw)
To: David Miller; +Cc: sparclinux, linux-kernel
On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
>
> On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
> > Hi
> >
> > When you compile kernel on Sparc64 with heap memory checking and type
> > "cat /proc/iomem", you get a crash, because pointers in struct resource
> > are uninitialized.
> >
> > Most code fills struct resource with zeros, so I assume that it is
> > responsibility of the caller of request_resource to initialized it, not
> > the responsibility of request_resource functuion.
> >
> > After 2.6.29 is out, there could be a check for uninitialized fields added
> > to request_resource to avoid crashes like this.
> >
> > Mikulas
>
> I forgot to add:
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
... and
Cc: stable@kernel.org
because it applies to old kernels as well, even 2.6.26 crashes.
Mikulas
> > ---
> > arch/sparc/kernel/pci_common.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > Index: linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c
> > =================================> > --- linux-2.6.29-rc8-devel.orig/arch/sparc/kernel/pci_common.c 2009-03-17 12:49:51.000000000 +0100
> > +++ linux-2.6.29-rc8-devel/arch/sparc/kernel/pci_common.c 2009-03-17 12:50:16.000000000 +0100
> > @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
> > const u32 *vdma = of_get_property(pbm->op->node, "virtual-dma", NULL);
> >
> > if (vdma) {
> > - struct resource *rp = kmalloc(sizeof(*rp), GFP_KERNEL);
> > + struct resource *rp = kzalloc(sizeof(*rp), GFP_KERNEL);
> >
> > if (!rp) {
> > prom_printf("Cannot allocate IOMMU resource.\n");
> >
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
2009-03-17 13:35 ` Mikulas Patocka
@ 2009-03-17 19:15 ` David Miller
-1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-03-17 19:15 UTC (permalink / raw)
To: mpatocka; +Cc: sparclinux, linux-kernel
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Tue, 17 Mar 2009 09:35:23 -0400 (EDT)
> Cc: stable@kernel.org
>
> because it applies to old kernels as well, even 2.6.26 crashes.
-stable will be sent a copy by me when it hits Linus's tree, and no
sooner.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-17 19:15 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-03-17 19:15 UTC (permalink / raw)
To: mpatocka; +Cc: sparclinux, linux-kernel
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Tue, 17 Mar 2009 09:35:23 -0400 (EDT)
> Cc: stable@kernel.org
>
> because it applies to old kernels as well, even 2.6.26 crashes.
-stable will be sent a copy by me when it hits Linus's tree, and no
sooner.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
2009-03-17 12:08 ` Mikulas Patocka
@ 2009-03-19 6:53 ` David Miller
-1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-03-19 6:53 UTC (permalink / raw)
To: mpatocka; +Cc: sparclinux, linux-kernel
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Tue, 17 Mar 2009 08:08:08 -0400 (EDT)
>
>
> On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
> > Hi
> >
> > When you compile kernel on Sparc64 with heap memory checking and type
> > "cat /proc/iomem", you get a crash, because pointers in struct resource
> > are uninitialized.
> >
> > Most code fills struct resource with zeros, so I assume that it is
> > responsibility of the caller of request_resource to initialized it, not
> > the responsibility of request_resource functuion.
> >
> > After 2.6.29 is out, there could be a check for uninitialized fields added
> > to request_resource to avoid crashes like this.
> >
> > Mikulas
>
> I forgot to add:
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Patch applied and queued up for -stable, thanks a lot.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH] crash with /proc/iomem on sparc64
@ 2009-03-19 6:53 ` David Miller
0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2009-03-19 6:53 UTC (permalink / raw)
To: mpatocka; +Cc: sparclinux, linux-kernel
From: Mikulas Patocka <mpatocka@redhat.com>
Date: Tue, 17 Mar 2009 08:08:08 -0400 (EDT)
>
>
> On Tue, 17 Mar 2009, Mikulas Patocka wrote:
>
> > Hi
> >
> > When you compile kernel on Sparc64 with heap memory checking and type
> > "cat /proc/iomem", you get a crash, because pointers in struct resource
> > are uninitialized.
> >
> > Most code fills struct resource with zeros, so I assume that it is
> > responsibility of the caller of request_resource to initialized it, not
> > the responsibility of request_resource functuion.
> >
> > After 2.6.29 is out, there could be a check for uninitialized fields added
> > to request_resource to avoid crashes like this.
> >
> > Mikulas
>
> I forgot to add:
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Patch applied and queued up for -stable, thanks a lot.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-03-19 6:53 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-17 12:03 [PATCH] crash with /proc/iomem on sparc64 Mikulas Patocka
2009-03-17 12:03 ` Mikulas Patocka
2009-03-17 12:08 ` Mikulas Patocka
2009-03-17 12:08 ` Mikulas Patocka
2009-03-17 13:35 ` Mikulas Patocka
2009-03-17 13:35 ` Mikulas Patocka
2009-03-17 19:15 ` David Miller
2009-03-17 19:15 ` David Miller
2009-03-19 6:53 ` David Miller
2009-03-19 6:53 ` David Miller
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.