All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip PATCH] futex: fix futex_wait_setup key handling
@ 2009-04-10 16:23 Darren Hart
  2009-04-10 16:33 ` Thomas Gleixner
  0 siblings, 1 reply; 2+ messages in thread
From: Darren Hart @ 2009-04-10 16:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Darren Hart, Thomas Gleixner, Ingo Molnar

If the get_futex_key() call were to fail, the existing code would
try and put_futex_key() prior to returning.  This patch makes sure
we only put_futex_key() if get_futex_key() succeeded.

Please apply to -rt and to tip:/core/futexes.

Reported-by: Clark Williams <williams@redhat.com>
Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
---

 kernel/futex.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/futex.c b/kernel/futex.c
index 185c981..4357f06 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1657,7 +1657,7 @@ retry_private:
 
 		ret = get_user(uval, uaddr);
 		if (ret)
-			goto out;
+			goto out_put_key;
 
 		if (!fshared)
 			goto retry_private;
@@ -1671,9 +1671,10 @@ retry_private:
 		ret = -EWOULDBLOCK;
 	}
 
-out:
+out_put_key:
 	if (ret)
 		put_futex_key(fshared, &q->key);
+out:
 	return ret;
 }
 


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

* Re: [tip PATCH] futex: fix futex_wait_setup key handling
  2009-04-10 16:23 [tip PATCH] futex: fix futex_wait_setup key handling Darren Hart
@ 2009-04-10 16:33 ` Thomas Gleixner
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Gleixner @ 2009-04-10 16:33 UTC (permalink / raw)
  To: Darren Hart; +Cc: linux-kernel, Ingo Molnar

On Fri, 10 Apr 2009, Darren Hart wrote:

> If the get_futex_key() call were to fail, the existing code would
> try and put_futex_key() prior to returning.  This patch makes sure
> we only put_futex_key() if get_futex_key() succeeded.
> 
> Please apply to -rt and to tip:/core/futexes.
> 
> Reported-by: Clark Williams <williams@redhat.com>
> Signed-off-by: Darren Hart <dvhltc@us.ibm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@elte.hu>
> ---
> 
>  kernel/futex.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index 185c981..4357f06 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -1657,7 +1657,7 @@ retry_private:
>  
>  		ret = get_user(uval, uaddr);
>  		if (ret)
> -			goto out;
> +			goto out_put_key;
>  
>  		if (!fshared)
>  			goto retry_private;
> @@ -1671,9 +1671,10 @@ retry_private:
>  		ret = -EWOULDBLOCK;
>  	}
>  
> -out:
> +out_put_key:
>  	if (ret)
>  		put_futex_key(fshared, &q->key);
> +out:
>  	return ret;

Yikes. Can we please convert the places which do "goto out;" to
"return ret;" ?

Thanks,

	tglx

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

end of thread, other threads:[~2009-04-10 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-10 16:23 [tip PATCH] futex: fix futex_wait_setup key handling Darren Hart
2009-04-10 16:33 ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.