Thread (2 messages) 2 messages, 2 authors, 2008-08-31

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

From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Date: 2008-08-31 16:11:40
Also in: lkml

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 <redacted>
thanks, applied
quoted hunk ↗ jump to hunk
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help