Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Tue, 19 Nov 2002 07:17:08 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Tue, 19 Nov 2002 07:17:07 -0500 Received: from noodles.codemonkey.org.uk ([213.152.47.19]:35558 "EHLO noodles.internal") by vger.kernel.org with ESMTP id ; Tue, 19 Nov 2002 07:17:06 -0500 Date: Tue, 19 Nov 2002 12:22:21 +0000 From: Dave Jones To: Nathan Scott Cc: alan@redhat.com, linux-kernel@vger.kernel.org Subject: Re: Memory leak in 2.4 vmalloc.c get_vm_area Message-ID: <20021119122221.GC27292@suse.de> Mail-Followup-To: Dave Jones , Nathan Scott , alan@redhat.com, linux-kernel@vger.kernel.org References: <20021118233202.GB535@frodo.melbourne.sgi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021118233202.GB535@frodo.melbourne.sgi.com> User-Agent: Mutt/1.4i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1488 Lines: 41 On Tue, Nov 19, 2002 at 10:32:02AM +1100, Nathan Scott wrote: > hi Alan, > > I noticed you recently merged this patch with Marcelo in the > 2.4 BK tree (lists you as author, and annotation says it came > from DaveM originally)... > > --- 1.10/mm/vmalloc.c Tue Feb 5 06:10:20 2002 > +++ 1.11/mm/vmalloc.c Thu Sep 5 05:22:42 2002 > @@ -177,6 +177,8 @@ > if (!area) > return NULL; > size += PAGE_SIZE; > + if(!size) > + return NULL; > addr = VMALLOC_START; > write_lock(&vmlist_lock); > for (p = &vmlist; (tmp = *p) ; p = &tmp->next) { > > > This looks to me like it introduces a memory leak in the new !size > case - either the "size" bump and test needs to be moved before the > "area" kmalloc, or we need to kfree(area) before returning NULL. > > If you like, I'll make a (trivial) patch to do one of these? Correct diagnosis. Patch went to Marcelo a while back. (Which I thought he took). Alan already picked it up iirc. Will retransmit, as this is -rc material IMO. Dave -- | Dave Jones. http://www.codemonkey.org.uk | SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/