public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exec: setup_arg_pages fails to return errors
@ 2009-10-18 11:39 Anton Blanchard
  2009-10-21  4:14 ` Serge E. Hallyn
  2009-10-21  4:47 ` Américo Wang
  0 siblings, 2 replies; 3+ messages in thread
From: Anton Blanchard @ 2009-10-18 11:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm


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@samba.org>
---

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);
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exec: setup_arg_pages fails to return errors
  2009-10-18 11:39 [PATCH] exec: setup_arg_pages fails to return errors Anton Blanchard
@ 2009-10-21  4:14 ` Serge E. Hallyn
  2009-10-21  4:47 ` Américo Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Serge E. Hallyn @ 2009-10-21  4:14 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linux-kernel, akpm

Quoting Anton Blanchard (anton@samba.org):
> 
> 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@samba.org>

Yikes!

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
> 
> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exec: setup_arg_pages fails to return errors
  2009-10-18 11:39 [PATCH] exec: setup_arg_pages fails to return errors Anton Blanchard
  2009-10-21  4:14 ` Serge E. Hallyn
@ 2009-10-21  4:47 ` Américo Wang
  1 sibling, 0 replies; 3+ messages in thread
From: Américo Wang @ 2009-10-21  4:47 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: linux-kernel, akpm

On Sun, Oct 18, 2009 at 7:39 PM, Anton Blanchard <anton@samba.org> 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@samba.org>
> ---


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

>
> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-10-21  5:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-18 11:39 [PATCH] exec: setup_arg_pages fails to return errors Anton Blanchard
2009-10-21  4:14 ` Serge E. Hallyn
2009-10-21  4:47 ` Américo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox