From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43731C4338F for ; Fri, 30 Jul 2021 14:22:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E1E56101C for ; Fri, 30 Jul 2021 14:22:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239535AbhG3OWP (ORCPT ); Fri, 30 Jul 2021 10:22:15 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:56108 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239257AbhG3OSP (ORCPT ); Fri, 30 Jul 2021 10:18:15 -0400 Message-ID: <20210730135208.254890678@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1627654689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=C2Vo4XXDlt6QXjXgpvqtBd+Wz/AeHGU1nda0oZEGxhw=; b=bP4uqnYrx5w7qSfuoy6mtyMRjezCblqWoNXSComDOxPkKOYOCSPgyaiESyb26Ne6Zuy+qe +T1vU3IfsBxmX0rkuDV5NeLQrNGgiHx8j43haAH5foYpHH17P616dorS0TvwPnnk8HIxjd InXpcKEFXHKsDOLHbIUEcvvzwgNY289f4oY09OTKAKVzD8zvK4EwAmXfpSL/onUMFJL8K7 io1J651sqcshUeCnHzpd9fsIKpS9G2rpyE68r+vU0/RU/BvpgVhZWHC4phqSYFPakSN40A ZYosNjw156Eag84iqL0nHfnkLP7WJ9luKvAn9dt4A+PQ2DydNxXwoUD6RpbTXA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1627654689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: references:references; bh=C2Vo4XXDlt6QXjXgpvqtBd+Wz/AeHGU1nda0oZEGxhw=; b=7sdp6s5PJmmbOQmu6YMzLdPC+ihNWYOuQ7LmxvEilE4jZ/bjUdL1tGdpnfNdlgu78Wsq3h epoaM+ygWaOH3JAg== Date: Fri, 30 Jul 2021 15:51:02 +0200 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Ingo Molnar , Juri Lelli , Steven Rostedt , Daniel Bristot de Oliveira , Will Deacon , Waiman Long , Boqun Feng , Sebastian Andrzej Siewior , Davidlohr Bueso Subject: [patch 55/63] futex: Correct the number of requeued waiters for PI References: <20210730135007.155909613@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Gleixner The accounting is wrong when either the PI sanity check or the requeue PI operation fails. Adjust it in the failure path. Will be simplified in the next step. Signed-off-by: Thomas Gleixner --- kernel/futex.c | 4 ++++ 1 file changed, 4 insertions(+) --- --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2128,6 +2128,8 @@ static int futex_requeue(u32 __user *uad /* Ensure we requeue to the expected futex for requeue_pi. */ if (requeue_pi && !match_futex(this->requeue_pi_key, &key2)) { + /* Don't account for it */ + task_count--; ret = -EINVAL; break; } @@ -2169,6 +2171,8 @@ static int futex_requeue(u32 __user *uad */ this->pi_state = NULL; put_pi_state(pi_state); + /* Don't account for it */ + task_count--; /* * We stop queueing more waiters and let user * space deal with the mess.