Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1540914 > unrolled thread

[PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI

Started byPeter Zijlstra <peterz@infradead.org>
First post2016-12-13 10:10 +0100
Last post2016-12-19 00:40 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI Peter Zijlstra <peterz@infradead.org> - 2016-12-13 10:10 +0100
    Re: [PATCH -v4 02/10] futex: Add missing error handling to  FUTEX_REQUEUE_PI Darren Hart <dvhart@infradead.org> - 2016-12-17 01:10 +0100
      Re: [PATCH -v4 02/10] futex: Add missing error handling to  FUTEX_REQUEUE_PI Peter Zijlstra <peterz@infradead.org> - 2016-12-17 15:00 +0100
        Re: [PATCH -v4 02/10] futex: Add missing error handling to  FUTEX_REQUEUE_PI Darren Hart <dvhart@infradead.org> - 2016-12-19 00:40 +0100

#1540914 — [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI

FromPeter Zijlstra <peterz@infradead.org>
Date2016-12-13 10:10 +0100
Subject[PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI
Message-ID<sNRfY-7LI-35@gated-at.bofh.it>
Thomas spotted that fixup_pi_state_owner() can return errors and we
fail to unlock the rt_mutex in that case.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
 kernel/futex.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -2896,6 +2896,8 @@ static int futex_wait_requeue_pi(u32 __u
 		if (q.pi_state && (q.pi_state->owner != current)) {
 			spin_lock(q.lock_ptr);
 			ret = fixup_pi_state_owner(uaddr2, &q, current);
+			if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current)
+				rt_mutex_unlock(&q.pi_state->pi_mutex);
 			/*
 			 * Drop the reference to the pi state which
 			 * the requeue_pi() code acquired for us.

[toc] | [next] | [standalone]


#1543854 — Re: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI

FromDarren Hart <dvhart@infradead.org>
Date2016-12-17 01:10 +0100
SubjectRe: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI
Message-ID<sPaJA-282-3@gated-at.bofh.it>
In reply to#1540914
On Tue, Dec 13, 2016 at 09:36:40AM +0100, Peter Zijlstra wrote:
> Thomas spotted that fixup_pi_state_owner() can return errors and we
> fail to unlock the rt_mutex in that case.
> 

We handled this explicitly before Patch 1/10, so can this be rolled into 1/10
(er 9) as a single commit?

> Reported-by: Thomas Gleixner <tglx@linutronix.de>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> ---
>  kernel/futex.c |    2 ++
>  1 file changed, 2 insertions(+)
> 
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -2896,6 +2896,8 @@ static int futex_wait_requeue_pi(u32 __u
>  		if (q.pi_state && (q.pi_state->owner != current)) {
>  			spin_lock(q.lock_ptr);
>  			ret = fixup_pi_state_owner(uaddr2, &q, current);
> +			if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current)
> +				rt_mutex_unlock(&q.pi_state->pi_mutex);
>  			/*
>  			 * Drop the reference to the pi state which
>  			 * the requeue_pi() code acquired for us.
> 
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

[toc] | [prev] | [next] | [standalone]


#1543974 — Re: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI

FromPeter Zijlstra <peterz@infradead.org>
Date2016-12-17 15:00 +0100
SubjectRe: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI
Message-ID<sPnGO-1Ui-17@gated-at.bofh.it>
In reply to#1543854
On Fri, Dec 16, 2016 at 04:06:39PM -0800, Darren Hart wrote:
> On Tue, Dec 13, 2016 at 09:36:40AM +0100, Peter Zijlstra wrote:
> > Thomas spotted that fixup_pi_state_owner() can return errors and we
> > fail to unlock the rt_mutex in that case.
> > 
> 
> We handled this explicitly before Patch 1/10, so can this be rolled into 1/10
> (er 9) as a single commit?

I don't think we did, see how this branch doesn't set pi_mutex.

[toc] | [prev] | [next] | [standalone]


#1544225 — Re: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI

FromDarren Hart <dvhart@infradead.org>
Date2016-12-19 00:40 +0100
SubjectRe: [PATCH -v4 02/10] futex: Add missing error handling to FUTEX_REQUEUE_PI
Message-ID<sPTdE-8rg-33@gated-at.bofh.it>
In reply to#1543974
On Sat, Dec 17, 2016 at 02:54:11PM +0100, Peter Zijlstra wrote:
> On Fri, Dec 16, 2016 at 04:06:39PM -0800, Darren Hart wrote:
> > On Tue, Dec 13, 2016 at 09:36:40AM +0100, Peter Zijlstra wrote:
> > > Thomas spotted that fixup_pi_state_owner() can return errors and we
> > > fail to unlock the rt_mutex in that case.
> > > 
> > 
> > We handled this explicitly before Patch 1/10, so can this be rolled into 1/10
> > (er 9) as a single commit?
> 
> I don't think we did, see how this branch doesn't set pi_mutex.
> 

So it is, I stand corrected. So for 2/10 also then:

Reviewed-by: Darren Hart <dvhart@linux.intel.com>

-- 
Darren Hart
Intel Open Source Technology Center

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web