Re: [PATCH 1/1] 2.4.32 Fix memory leak in ide-probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Nick,

If it works please forward the results and other information to everyone

Cheers,

Andre Hedrick
LAD Storage Consulting Group

On Mon, 22 May 2006, Nick Pollitt wrote:

> Andre,  I found this memory leak running a bash loop calling cardctl to insert 
> and eject a single PCMCIA card continuously.  Over time the slab-32 and slab-64
> caches had consumed all system memory.  The memory was full of the IDE
> settings allocated in ide_add_generic_settings.  
> 
> It appears that ide_add_generic_settings is getting called for interfaces that
> aren't present, and there are never any calls to free up those resources.  The
> check for the presence of the interface was removed in 2.4.19, and this patch
> rolls back to the previous behavior.
> 
> If this looks OK I'd like to ask Marcello to include in the next 2.4 rev.
> 
> Thank you,
> Nick
> 

diff -X dontdiff -Nurp linux-2.4.32-orig/drivers/ide/ide-probe.c linux-2.4.32/drivers/ide/ide-probe.c
--- linux-2.4.32-orig/drivers/ide/ide-probe.c	2004-04-14 06:05:29.000000000 -0700
+++ linux-2.4.32/drivers/ide/ide-probe.c	2006-05-22 10:59:54.494810412 -0700
@@ -1241,15 +1241,15 @@ static void init_gendisk (ide_hwif_t *hw
 	add_gendisk(gd);
 
 	for (unit = 0; unit < units; ++unit) {
-		char name[64];
-		ide_add_generic_settings(hwif->drives + unit);
-//		hwif->drives[unit].dn = ((hwif->channel ? 2 : 0) + unit);
-		sprintf (name, "host%d/bus%d/target%d/lun%d",
-			(hwif->channel && hwif->mate) ?
-			hwif->mate->index : hwif->index,
-			hwif->channel, unit, hwif->drives[unit].lun);
-		if (hwif->drives[unit].present)
+		if (hwif->drives[unit].present) {
+			char name[64];
+			ide_add_generic_settings(hwif->drives + unit);
+			sprintf (name, "host%d/bus%d/target%d/lun%d",
+				(hwif->channel && hwif->mate) ?
+				hwif->mate->index : hwif->index,
+				hwif->channel, unit, hwif->drives[unit].lun);
 			hwif->drives[unit].de = devfs_mk_dir(ide_devfs_handle, name, NULL);
+		}
 	}
 	return;
 

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux