Skip to content

Commit 99d403f

Browse files
Peter Zijlstragregkh
authored andcommitted
futex: Add missing error handling to FUTEX_REQUEUE_PI
commit 9bbb25afeb182502ca4f2c4f3f88af0681b34cae upstream. 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 Link: http://lkml.kernel.org/r/20170304093558.867401760@infradead.org Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 44854c1 commit 99d403f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

kernel/futex.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,6 +2773,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
27732773
if (q.pi_state && (q.pi_state->owner != current)) {
27742774
spin_lock(q.lock_ptr);
27752775
ret = fixup_pi_state_owner(uaddr2, &q, current);
2776+
if (ret && rt_mutex_owner(&q.pi_state->pi_mutex) == current)
2777+
rt_mutex_unlock(&q.pi_state->pi_mutex);
27762778
/*
27772779
* Drop the reference to the pi state which
27782780
* the requeue_pi() code acquired for us.

0 commit comments

Comments
 (0)