From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753094AbdCNUt5 (ORCPT ); Tue, 14 Mar 2017 16:49:57 -0400 Received: from terminus.zytor.com ([65.50.211.136]:49742 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751208AbdCNUt4 (ORCPT ); Tue, 14 Mar 2017 16:49:56 -0400 Date: Tue, 14 Mar 2017 13:49:24 -0700 From: tip-bot for Peter Zijlstra Message-ID: Cc: mingo@kernel.org, hpa@zytor.com, peterz@infradead.org, tglx@linutronix.de, dvhart@linux.intel.com, linux-kernel@vger.kernel.org Reply-To: linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, dvhart@linux.intel.com, hpa@zytor.com, mingo@kernel.org In-Reply-To: <20170304093558.867401760@infradead.org> References: <20170304093558.867401760@infradead.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:locking/urgent] futex: Add missing error handling to FUTEX_REQUEUE_PI Git-Commit-ID: 9bbb25afeb182502ca4f2c4f3f88af0681b34cae X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 9bbb25afeb182502ca4f2c4f3f88af0681b34cae Gitweb: http://git.kernel.org/tip/9bbb25afeb182502ca4f2c4f3f88af0681b34cae Author: Peter Zijlstra AuthorDate: Sat, 4 Mar 2017 10:27:19 +0100 Committer: Thomas Gleixner CommitDate: Tue, 14 Mar 2017 21:45:36 +0100 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 Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Darren Hart 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 --- kernel/futex.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index 3a4775f..45858ec 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, 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.