pata_octeon_cf: fix ata_host_activate() failure handling
PATCH 1/1 pata_octeon_cf: fix ata_host_activate() failure handling
Add missing kfree() call to ata_host_activate() failure path.
--- drivers/ata/pata_octeon_cf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/ata/pata_octeon_cf.c +6 -3
@@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfoata_port_desc (ap,"cmd %p ctl %p" , base, ap->ioaddr.ctl_addr); -dev_info (&pdev->dev,"version " DRV_VERSION " %d bit%s.\n" , is_16bit ?16 :8 , cf_port->is_true_ide ?", True IDE" :"" ); -return ata_host_activate (host, irq, irq_handler, -IRQF_SHARED , &octeon_cf_sht); + rv =ata_host_activate (host, irq, irq_handler, +IRQF_SHARED , &octeon_cf_sht); +if (rv) + goto free_cf_port; + +return 0 ; free_cf_port:kfree (cf_port);
Quoted 2 lines · Bartlomiej Zolnierkiewicz
Add missing
kfree()call toata_host_activate()failure path.
Are you seeing failures in real systems, or is this just a change to fix a theoretical memory leak?
Quoted 2 lines
Cc Ralf Baechle <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>
Did you test the patch on real hardware? If so, you can add:
Otherwise, somebody will have to go and test it.
Thanks,
David Daney
Quoted 36 lines
--- drivers/ata/pata_octeon_cf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)Index:
b/drivers/ata/pata_octeon_cf.c
===================================================================drivers/ata/pata_octeon_cf.c +6
-4@@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfoata_port_desc (ap,"cmd %p ctl %p" , base, ap->ioaddr.ctl_addr); -dev_info (&pdev->dev,"version " DRV_VERSION " %d bit%s.\n" , is_16bit ?16 :8 , cf_port->is_true_ide ?", True IDE" :"" ); -return ata_host_activate (host, irq, irq_handler, -IRQF_SHARED , &octeon_cf_sht); + rv =ata_host_activate (host, irq, irq_handler, +IRQF_SHARED , &octeon_cf_sht); +if (rv) + goto free_cf_port; + +return 0 ; free_cf_port:kfree (cf_port); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 18 lines · Bartlomiej Zolnierkiewicz
Add missing
kfree()call toata_host_activate()failure path.Cc Ralf Baechle <[email protected]>Signed-off-by Bartlomiej Zolnierkiewicz <[email protected]>--- drivers/ata/pata_octeon_cf.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)Index:
b/drivers/ata/pata_octeon_cf.c
===================================================================drivers/ata/pata_octeon_cf.c +0
-1@@ -1020,13 +1020,16 @@ static int octeon_cf_probe(struct platfoata_port_desc (ap,"cmd %p ctl %p" , base, ap->ioaddr.ctl_addr); - dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
drivers/ata/pata_octeon_cf.c static int octeon_cf_probe(struct platfo · line 1031
Quoted 10 lines
drivers/ata/pata_octeon_cf.c +5
-2is_16bit ?16 :8 , cf_port->is_true_ide ? ", True IDE" : ""); -return ata_host_activate (host, irq, irq_handler, -IRQF_SHARED , &octeon_cf_sht); + rv =ata_host_activate (host, irq, irq_handler, +IRQF_SHARED , &octeon_cf_sht); +if (rv) + goto free_cf_port; +
Just a few lines above:
rv = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
if (rv)
return rv;So you don't really completely fix the leak, it be theoretic or not.
It might be better (and actually simplify the code) to use devm_kzalloc().
Guenter
Quoted 14 lines
drivers/ata/pata_octeon_cf.c +1
-1+return 0 ; free_cf_port:kfree (cf_port); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/