Re: via sata oops on init

From: Dave Jones
Date: Sat Jul 29 2006 - 12:39:18 EST


On Sat, Jul 29, 2006 at 04:45:28PM +0200, Johannes Weiner wrote:

> ..
> ata_device_add fails, calls ata_host_remove with pointers to unitialized
> memory.

This should do it. Jeff?

Fix reference of uninitialised memory in ata_device_add()

Signed-off-by: Dave Jones <davej@xxxxxxxxxx>

--- linux-2.6/drivers/scsi/libata-core.c~ 2006-07-29 12:35:32.000000000 -0400
+++ linux-2.6/drivers/scsi/libata-core.c 2006-07-29 12:39:08.000000000 -0400
@@ -5419,10 +5419,10 @@ int ata_device_add(const struct ata_prob
unsigned long xfer_mode_mask;

ap = ata_host_add(ent, host_set, i);
+ host_set->ports[i] = ap;
if (!ap)
goto err_out;

- host_set->ports[i] = ap;
xfer_mode_mask =(ap->udma_mask << ATA_SHIFT_UDMA) |
(ap->mwdma_mask << ATA_SHIFT_MWDMA) |
(ap->pio_mask << ATA_SHIFT_PIO);
@@ -5532,6 +5532,8 @@ int ata_device_add(const struct ata_prob

err_out:
for (i = 0; i < count; i++) {
+ if (!host_set->ports[i])
+ break;
ata_host_remove(host_set->ports[i], 1);
scsi_host_put(host_set->ports[i]->host);
}

--
http://www.codemonkey.org.uk
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/