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 601A7C4338F for ; Wed, 11 Aug 2021 12:26:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42F5861019 for ; Wed, 11 Aug 2021 12:26:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238435AbhHKM00 (ORCPT ); Wed, 11 Aug 2021 08:26:26 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:51114 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237962AbhHKMYI (ORCPT ); Wed, 11 Aug 2021 08:24:08 -0400 Message-ID: <20210811121417.647465659@linutronix.de> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1628684623; 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=3ytooRkFdVoLIkQBvivN8bveK+9EeU1H5HgaN+p1d3E=; b=ra2j/ouDwTmzcNhoU5W19aQStyGSVtVx0MqnMkmYzpFA1obsLb1iEMowEvh5uHWk48r1xH RTghQzKzkMO02FHWEhjsQ7sh3Sr4m5fisSQAyv+WXBXKyEmc4C9tNAy6QMF5o+hG6YxFhk erourHIrMLQGGwqOl2CqcAMwhDrPJn3fneHz1jpwzgAS5FNVuPLu21PZkcvIf7JKdeOrJm OK4gXbvTGVLERVF4rQiKa6TP7cwsQs48z5ibgkHXuLamJIEzr+8wKjkZsUNPEO6MuZsTlJ 60SK8c6Y9MP/YkU/cBc1qu9FuLO2fTOwz8/OvAKrvqLY1TRdHAbN7+oItmb2yA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1628684623; 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=3ytooRkFdVoLIkQBvivN8bveK+9EeU1H5HgaN+p1d3E=; b=iOU1AuaQdjz+Oa9YtOaYjS/ZoOsPT9jIxL14Yej50jYzIUjL3OsyzjX5N6a+a3JDrY7QEE sWAfrLCCY0N1LEBQ== 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 , Mike Galbraith Subject: [patch V4 59/68] futex: Correct the number of requeued waiters for PI References: <20210811120348.855823694@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-transfer-encoding: 8-bit Date: Wed, 11 Aug 2021 14:23:43 +0200 (CEST) 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 @@ -2116,6 +2116,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; } @@ -2157,6 +2159,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.