lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 05 May 2008 11:26:49 +0200
From:	Nadia Derbey <Nadia.Derbey@...l.net>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	manfred@...orfullife.com, paulmck@...ux.vnet.ibm.com,
	linux-kernel@...r.kernel.org, efault@....de
Subject: Re: [PATCH 01/10] Fix idr_remove()

Andrew Morton wrote:
> On Tue, 29 Apr 2008 16:33:05 +0200
> Nadia.Derbey@...l.net wrote:
> 
> 
>>[PATCH 01/10]
>>
>>This patch fixes idr_remove(): the return inside the loop makes us free only
>>a single layer.
>>
>>Signed-off-by: Nadia Derbey <Nadia.Derbey@...l.net>
>>
>>---
>> lib/idr.c |    2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>>Index: linux-2.6.25-mm1/lib/idr.c
>>===================================================================
>>--- linux-2.6.25-mm1.orig/lib/idr.c	2008-04-25 15:29:00.000000000 +0200
>>+++ linux-2.6.25-mm1/lib/idr.c	2008-04-25 15:48:34.000000000 +0200
>>@@ -385,8 +385,8 @@ void idr_remove(struct idr *idp, int id)
>> 	while (idp->id_free_cnt >= IDR_FREE_MAX) {
>> 		p = alloc_layer(idp);
>> 		kmem_cache_free(idr_layer_cache, p);
>>-		return;
>> 	}
>>+	return;
>> }
>> EXPORT_SYMBOL(idr_remove);
> 
> 
> erk, ancient bug.
> 
> I _think_ the implications of this are that an idr tree will grow fatter
> than it needs to be, but there is no permanent leak: idr_destroy() will
> still free everything, yes?

Yes, exactly. Actually, I've not checked whether all the kernel 
components call idr_destroy() when needed.

> 
> And a consequence of the fix is that idr manipulations will now result in
> more allocs and frees,

Not necessarily more allocs: this loop keeps IDR_FREE_MAX layers in the 
free list. So idr_pre_get() should be a noop.

> but the amount of memory which a tree uses will be
> less?
> 
> 
> 

Regards,
Nadia


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ