lkml.org 
[lkml]   [1998]   [Jan]   [4]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateSun, 4 Jan 1998 02:21:34 -0600 (CST)
FromPhil Brutsche <>
SubjectRe: small memory leak in exec.c if exec_mmap fails
You didn't say - what kernel version is this for?  2.0.x or 2.1.x?

On Fri, 2 Jan 1998, Peeter Joot wrote:

> Hello,
> 
> I think I have noticed a small memory leak in exec.c:flush_old_exec().
> 
> If exec_mmap() fails on a process that has CLONE_SIGHAND created clones
> then the kmalloc'ed signal_struct won't be freed.
> 
> I have attached a small patch that should fix this (untested as
> it as it is not an easily reprodable scenerio)
> 
> Peeter
> --
> Peeter Joot
> http://www.accessv.com/~peeter                               peeter@accessv.com
> 
> 
> 
> --- exec.c.orig	Fri Jan  2 00:16:39 1998
> +++ exec.c	Fri Jan  2 00:16:07 1998
> @@ -518,7 +518,7 @@
>  	 * Release all of the old mmap stuff
>  	 */
>  	retval = exec_mmap();
> -	if (retval) goto flush_failed;
> +	if (retval) goto mmap_failed;
> 
>  	/* This is the point of no return */
>  	release_old_signals(oldsig);
> @@ -547,6 +547,9 @@
> 
>  	return 0;
> 
> +mmap_failed:
> +	if (current->sig != oldsig)
> +		kfree(current->sig);
>  flush_failed:
>  	current->sig = oldsig;
>  	return retval;
> 

----------------------------------------------------------------------
Phil Brutsche
"Be of stout heart, Number One.  We've handled the Borg.  We can
certainly handle Admiral Jellico." - Jean-Luc Picard

----------------------------------------------------------------------

\
 
 \ /
  Last update: 2005-03-22 12:41    [from the cache]
©2003-2008