The patch titled uml: cleanup run_helper() API to fix a leak has been added to the -mm tree. Its filename is uml-cleanup-run_helper-api-to-fix-a-leak.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: uml: cleanup run_helper() API to fix a leak From: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx> Freeing the stack is left uselessly to the caller of run_helper in some cases - this is taken from run_helper_thread, but here it is useless, so no caller needs it and the only place where this happens has a potential leak - in case of error neither run_helper() nor xterm_open() call free_stack(). At this point passing a pointer is not needed - the stack pointer should be passed directly, but this change is not done here. Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@xxxxxxxx> Cc: Jeff Dike <jdike@xxxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- arch/um/drivers/xterm.c | 2 -- arch/um/os-Linux/helper.c | 7 +++---- 2 files changed, 3 insertions(+), 6 deletions(-) diff -puN arch/um/drivers/xterm.c~uml-cleanup-run_helper-api-to-fix-a-leak arch/um/drivers/xterm.c --- a/arch/um/drivers/xterm.c~uml-cleanup-run_helper-api-to-fix-a-leak +++ a/arch/um/drivers/xterm.c @@ -136,8 +136,6 @@ int xterm_open(int input, int output, in return(pid); } - if(data->stack == 0) free_stack(stack, 0); - if (data->direct_rcv) { new = os_rcv_fd(fd, &data->helper_pid); } else { diff -puN arch/um/os-Linux/helper.c~uml-cleanup-run_helper-api-to-fix-a-leak arch/um/os-Linux/helper.c --- a/arch/um/os-Linux/helper.c~uml-cleanup-run_helper-api-to-fix-a-leak +++ a/arch/um/os-Linux/helper.c @@ -52,7 +52,8 @@ static int helper_child(void *arg) } /* Returns either the pid of the child process we run or -E* on failure. - * XXX The alloc_stack here breaks if this is called in the tracing thread */ + * XXX The alloc_stack here breaks if this is called in the tracing thread, so + * we need to receive a preallocated stack (a local buffer is ok). */ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, unsigned long *stack_out) { @@ -118,10 +119,8 @@ out_close: close(fds[1]); close(fds[0]); out_free: - if (stack_out == NULL) + if ((stack_out == NULL) || (*stack_out == 0)) free_stack(stack, 0); - else - *stack_out = stack; return ret; } _ Patches currently in -mm which might be from blaisorblade@xxxxxxxx are uml-mode_tt-is-bust.patch fix-typo-in-memory-barrier-docs.patch uml-remove-some-leftover-ppc-code.patch uml-split-memory-allocation-prototypes-out-of-userh.patch uml-fix-prototypes.patch uml-make-execvp-safe-for-our-usage.patch uml-code-convention-cleanup-of-a-file.patch uml-reenable-compilation-of-enable_timer-disabled-by-mistake.patch uml-use-defconfig_list-to-avoid-reading-hosts-config.patch uml-cleanup-run_helper-api-to-fix-a-leak.patch uml-kconfig-silence-warning.patch uml-mmapper-remove-just-added-but-wrong-const-attribute.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html