Return-Path: Received: from aserp1040.oracle.com ([141.146.126.69]:46234 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752960AbcBJPNb (ORCPT ); Wed, 10 Feb 2016 10:13:31 -0500 From: Sasha Levin To: stable@vger.kernel.org, stable-commits@vger.kernel.org Cc: Thomas Gleixner , Peter Zijlstra , Darren Hart , Davidlohr Bueso , Bhuvanesh_Surachari@mentor.com, Andy Lowe , Sasha Levin Subject: [added to the 4.1 stable tree] futex: Drop refcount if requeue_pi() acquired the rtmutex Date: Wed, 10 Feb 2016 10:08:47 -0500 Message-Id: <1455117136-28870-23-git-send-email-sasha.levin@oracle.com> In-Reply-To: <1455117136-28870-1-git-send-email-sasha.levin@oracle.com> References: <1455117136-28870-1-git-send-email-sasha.levin@oracle.com> Sender: stable-owner@vger.kernel.org List-ID: From: Thomas Gleixner This patch has been added to the 4.1 stable tree. If you have any objections, please let us know. =============== [ Upstream commit fb75a4282d0d9a3c7c44d940582c2d226cf3acfb ] If the proxy lock in the requeue loop acquires the rtmutex for a waiter then it acquired also refcount on the pi_state related to the futex, but the waiter side does not drop the reference count. Add the missing free_pi_state() call. Signed-off-by: Thomas Gleixner Cc: Peter Zijlstra Cc: Darren Hart Cc: Davidlohr Bueso Cc: Bhuvanesh_Surachari@mentor.com Cc: Andy Lowe Link: http://lkml.kernel.org/r/20151219200607.178132067@linutronix.de Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin --- kernel/futex.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/futex.c b/kernel/futex.c index 2579e40..f3043db 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2632,6 +2632,11 @@ 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); + /* + * Drop the reference to the pi state which + * the requeue_pi() code acquired for us. + */ + free_pi_state(q.pi_state); spin_unlock(q.lock_ptr); } } else { -- 2.5.0