Re: [Patch 3/9] fs/compat.c: fix resource leaks and wrong goto's

From: Al Viro
Date: Sat May 10 2008 - 15:21:21 EST


On Thu, May 08, 2008 at 09:52:28PM +0800, WANG Cong wrote:
> Use free_arg_pages() to free the pages allocated by copy_strings_kernel()
> on failure. And fix some related wrong goto pathes.

Kinda; free_arg_pages() is needed here, but there's no need to mess with
goto - just put it under out:

Note that it's essentially just a part of freeing bprm; it's _not_ a "clean
collected strings, so that we could add new ones".

> @@ -1403,6 +1403,7 @@ int compat_do_execve(char * filename,
> retval = search_binary_handler(bprm, regs);
> if (retval >= 0) {
> /* execve success */
> + free_arg_pages(bprm);
> security_bprm_free(bprm);
> acct_update_integrals(current);
> kfree(bprm);
> @@ -1410,6 +1411,9 @@ int compat_do_execve(char * filename,
> }
>
> out:
> + free_arg_pages(bprm);
> +
> +out_sec:
> if (bprm->security)
> security_bprm_free(bprm);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/