lkml.org 
[lkml]   [2009]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 08/60] sparc64: Fix crash with /proc/iomem
    -stable review patch.  If anyone has any objections, please let us know.

    ------------------
    From: Mikulas Patocka <mpatocka@redhat.com>


    [ Upstream commit 192d7a4667c6d11d1a174ec4cad9a3c5d5f9043c ]

    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.

    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
    ---
    arch/sparc64/kernel/pci_common.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/arch/sparc64/kernel/pci_common.c
    +++ b/arch/sparc64/kernel/pci_common.c
    @@ -368,7 +368,7 @@ static void pci_register_iommu_region(st
    const u32 *vdma = of_get_property(pbm->prom_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");



    \
     
     \ /
      Last update: 2009-06-10 05:37    [W:0.020 / U:31.768 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site