From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423490AbcBZWUr (ORCPT ); Fri, 26 Feb 2016 17:20:47 -0500 Received: from mail.kernel.org ([198.145.29.136]:52083 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423453AbcBZWUk (ORCPT ); Fri, 26 Feb 2016 17:20:40 -0500 Message-Id: <20160226213931.473920838@goodmis.org> User-Agent: quilt/0.61-1 Date: Fri, 26 Feb 2016 16:39:14 -0500 From: Steven Rostedt To: linux-kernel@vger.kernel.org, linux-rt-users Cc: Thomas Gleixner , Carsten Emde , Sebastian Andrzej Siewior , John Kacur , Paul Gortmaker , Subject: [PATCH RT 03/10] rtmutex: Handle non enqueued waiters gracefully References: <20160226213911.445523575@goodmis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=0003-rtmutex-Handle-non-enqueued-waiters-gracefully.patch Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.12.54-rt73-rc1 stable review patch. If anyone has any objections, please let me know. ------------------ From: Thomas Gleixner Yimin debugged that in case of a PI wakeup in progress when rt_mutex_start_proxy_lock() calls task_blocks_on_rt_mutex() the latter returns -EAGAIN and in consequence the remove_waiter() call runs into a BUG_ON() because there is nothing to remove. Guard it with rt_mutex_has_waiters(). This is a quick fix which is easy to backport. The proper fix is to have a central check in remove_waiter() so we can call it unconditionally. Reported-and-debugged-by: Yimin Deng Signed-off-by: Thomas Gleixner Cc: stable-rt@vger.kernel.org Signed-off-by: Steven Rostedt --- kernel/rtmutex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c index 7601c1332a88..03439f1bc5ea 100644 --- a/kernel/rtmutex.c +++ b/kernel/rtmutex.c @@ -2065,7 +2065,7 @@ int rt_mutex_start_proxy_lock(struct rt_mutex *lock, ret = 0; } - if (unlikely(ret)) + if (ret && rt_mutex_has_waiters(lock)) remove_waiter(lock, waiter); raw_spin_unlock(&lock->wait_lock); -- 2.7.0