From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752427AbdCDKIK (ORCPT ); Sat, 4 Mar 2017 05:08:10 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:50398 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752183AbdCDKIH (ORCPT ); Sat, 4 Mar 2017 05:08:07 -0500 Message-Id: <20170304093558.867401760@infradead.org> User-Agent: quilt/0.63-1 Date: Sat, 04 Mar 2017 10:27:19 +0100 From: Peter Zijlstra To: tglx@linutronix.de Cc: mingo@kernel.org, juri.lelli@arm.com, rostedt@goodmis.org, xlpang@redhat.com, bigeasy@linutronix.de, linux-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com, jdesfossez@efficios.com, bristot@redhat.com, dvhart@infradead.org, peterz@infradead.org, Darren Hart Subject: [PATCH -v5 02/14] futex: Add missing error handling to FUTEX_REQUEUE_PI References: <20170304092717.762954142@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=peter_zijlstra-futex-fix_missing_error_handling.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thomas spotted that fixup_pi_state_owner() can return errors and we fail to unlock the rt_mutex in that case. Reviewed-by: Darren Hart Reported-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) --- 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.