diff options
author | Peter Zijlstra <peterz@infradead.org> | 2017-03-04 04:27:19 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2017-03-14 16:45:36 -0400 |
commit | 9bbb25afeb182502ca4f2c4f3f88af0681b34cae (patch) | |
tree | dc5b892ea7ce2ac927eb9ed39d97012bfedd7d23 /kernel/futex.c | |
parent | c236c8e95a3d395b0494e7108f0d41cf36ec107c (diff) |
futex: Add missing error handling to FUTEX_REQUEUE_PI
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>
Reviewed-by: Darren Hart <dvhart@linux.intel.com>
Cc: juri.lelli@arm.com
Cc: bigeasy@linutronix.de
Cc: xlpang@redhat.com
Cc: rostedt@goodmis.org
Cc: mathieu.desnoyers@efficios.com
Cc: jdesfossez@efficios.com
Cc: dvhart@infradead.org
Cc: bristot@redhat.com
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20170304093558.867401760@infradead.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/futex.c')
-rw-r--r-- | kernel/futex.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kernel/futex.c b/kernel/futex.c index 3a4775fd7468..45858ec73941 100644 --- a/kernel/futex.c +++ b/kernel/futex.c | |||
@@ -2898,6 +2898,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags, | |||
2898 | if (q.pi_state && (q.pi_state->owner != current)) { | 2898 | if (q.pi_state && (q.pi_state->owner != current)) { |
2899 | spin_lock(q.lock_ptr); | 2899 | spin_lock(q.lock_ptr); |
2900 | ret = fixup_pi_state_owner(uaddr2, &q, current); | 2900 | ret = fixup_pi_state_owner(uaddr2, &q, current); |
2901 | if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current) | ||
2902 | rt_mutex_unlock(&q.pi_state->pi_mutex); | ||
2901 | /* | 2903 | /* |
2902 | * Drop the reference to the pi state which | 2904 | * Drop the reference to the pi state which |
2903 | * the requeue_pi() code acquired for us. | 2905 | * the requeue_pi() code acquired for us. |