Re: [PATCH] ide: Two fixes regarding memory allocation

From: Bartlomiej Zolnierkiewicz
Date: Sun Aug 31 2008 - 12:11:42 EST


On Friday 29 August 2008, Elias Oltmanns wrote:
> In function ide_devset_execute() we should use __GFP_WAIT rather than
> GFP_KERNEL. Also, the allocation cannot possibly fail at that point.
> More importantly, there is a potential memory leak in the device probing
> code. The infrastructure seems rather complex and I hope I haven't messed
> anything up by trying to fix this.
>
> Signed-off-by: Elias Oltmanns <eo@xxxxxxxxxxxxxx>

thanks, applied

> @@ -972,12 +972,21 @@ static void ide_port_setup_devices(ide_hwif_t *hwif)
> if (ide_init_queue(drive)) {
> printk(KERN_ERR "ide: failed to init %s\n",
> drive->name);
> + spin_lock_irq(&ide_lock);
> + kfree(drive->id);
> + drive->id = NULL;
> + drive->dev_flags &= ~IDE_DFLAG_PRESENT;
> + spin_unlock_irq(&ide_lock);
> continue;

ide_lock taking is superfluous here, I removed it while merging the patch
--
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/