Re: [PATCH] exec: setup_arg_pages fails to return errors

From: AmÃrico Wang
Date: Wed Oct 21 2009 - 01:18:56 EST


On Sun, Oct 18, 2009 at 7:39 PM, Anton Blanchard <anton@xxxxxxxxx> wrote:
>
> In setup_arg_pages we work hard to assign a value to ret, but on exit
> we always return 0.
>
> Also remove a now duplicated exit path and branch to out_unlock instead.
>
> Signed-off-by: Anton Blanchard <anton@xxxxxxxxx>
> ---


Reviewed-by: WANG Cong <xiyou.wangcong@xxxxxxxxx>

>
> Index: linux.trees.git/fs/exec.c
> ===================================================================
> --- linux.trees.git.orig/fs/exec.c   Â2009-09-28 12:17:10.000000000 +1000
> +++ linux.trees.git/fs/exec.c  2009-09-28 12:17:58.000000000 +1000
> @@ -624,10 +624,8 @@ int setup_arg_pages(struct linux_binprm
> Â Â Â Â/* Move stack pages down in memory. */
> Â Â Â Âif (stack_shift) {
> Â Â Â Â Â Â Â Âret = shift_arg_pages(vma, stack_shift);
> - Â Â Â Â Â Â Â if (ret) {
> - Â Â Â Â Â Â Â Â Â Â Â up_write(&mm->mmap_sem);
> - Â Â Â Â Â Â Â Â Â Â Â return ret;
> - Â Â Â Â Â Â Â }
> + Â Â Â Â Â Â Â if (ret)
> + Â Â Â Â Â Â Â Â Â Â Â goto out_unlock;
> Â Â Â Â}
>
> Â#ifdef CONFIG_STACK_GROWSUP
> @@ -641,7 +639,7 @@ int setup_arg_pages(struct linux_binprm
>
> Âout_unlock:
> Â Â Â Âup_write(&mm->mmap_sem);
> - Â Â Â return 0;
> + Â Â Â return ret;
> Â}
> ÂEXPORT_SYMBOL(setup_arg_pages);
>
> --
> 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/
>
--
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/