Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1070804pxb; Wed, 1 Sep 2021 16:49:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzNauIZRe7CJFpjxvK7noosMjb+zNbo+/HK3joMZ7vlQcOJHIP5cfqMzcwtJAOWtHkxj/75 X-Received: by 2002:a05:6402:34d5:: with SMTP id w21mr482342edc.235.1630540180206; Wed, 01 Sep 2021 16:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630540180; cv=none; d=google.com; s=arc-20160816; b=l892hPVOpi+iQk1KiD7eyxcXFJhBH0k3FeIFr3ZrO16sncP4hrtcUvXm2NvsWZsJQO gfu+8D1MlzCw4627p4yi1D+oKXmNqMQ50J9Qqq2U+erD6JU9D+tJEdvpW30rODAsJdx1 46BrcNjPFBsB4laa3SjbWjp73H5XbgS2mjQ4JwJ+xuAA92JEg/yeHkNGKL9v9C6GFehf cTZnXEfE5JI7s2fkZAY9FSx3R/Q1stIoOF9GRIpXgewbEgYimEojGa7ibbDDFUJcf9Bs NEhQuiLsQJnn0A9ciXb2C5wIoFjIZm44VoQDXP6GYpFCeackFwO7Hy+ITogqDgh7Celo 0gTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=ikhT/bNDDiuyvn8y/gZbDDhHdEz/w7q7Zp6oSh20Hes=; b=KIWGhM6U8k4f/ewkitTaC0uq++pOikdoZnBhsLc42jiiHcfaQFHF7R+7yOhVbo2poe 28B6VhOmWxhOIGAkiPQkMh5HXJgk/K/LPUJPLSzZx9y3Cfe2k4K4of5PbysV/OEtxH7Z dPcBjTsu8Yj2xV5u4QPmbwdjv2q+osHhHDVQ9aKVqxpFJd0fG4QPmHdrll6PZRWKuH4j GhvQzjyCSdVh43oNiIFGG2kA/8PFeTG6EgQbDqlDbGk0jk8VPhQTx10GRUf6eWSnOu8B vM1HMtCPg/lHRm3UuyI/BAG2tt3B01AZ88L4eyJ0kFMf5bsWKG4ypqq039OPquAOmu59 xaBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I7L3Sx8Z; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk10si278351edb.32.2021.09.01.16.49.15; Wed, 01 Sep 2021 16:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I7L3Sx8Z; dkim=neutral (no key) header.i=@linutronix.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240445AbhIAT3f (ORCPT + 99 others); Wed, 1 Sep 2021 15:29:35 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:39106 "EHLO galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233472AbhIAT3f (ORCPT ); Wed, 1 Sep 2021 15:29:35 -0400 Date: Wed, 01 Sep 2021 19:28:35 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1630524517; h=from:from:sender:sender:reply-to: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: in-reply-to:in-reply-to:references:references; bh=ikhT/bNDDiuyvn8y/gZbDDhHdEz/w7q7Zp6oSh20Hes=; b=I7L3Sx8Z7hlIMmtCIO4WPRcAmf8U6guzl+SGC79xFVK3/9qkhV8EqiO+5Mwt/TTzNn3N6d LmhE69rU6xGS1yy/L4uDYMKYFWINIzmZdzdkHVwT+XWgLLZwSQ1R9nG4rrW+Q/ezsDLpZG KEFqxjobKt82WM6E+sb96H8XauziMUgJ/JZO9lZl+c1w9TOoOVCJGkqfVUaYHj1kgEdN3r TJT8heGuqPrOSovn9N03vAmqCkFCDjR7G2YABGz1pcgY//jTZSBPwsvA/5v1gkZj2sACa1 z/PD3Q9HhZw9gr32p4aZcpwev/1WkM0P8njVS2o16xet95fSFl7rL3NuUfBbwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1630524517; h=from:from:sender:sender:reply-to: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: in-reply-to:in-reply-to:references:references; bh=ikhT/bNDDiuyvn8y/gZbDDhHdEz/w7q7Zp6oSh20Hes=; b=v7BT0ugc/apqXlHX3Fw48F2TZOCSKAdvKgHG+8FsRFpvz8tuUqHKiYbxEq9tLsceqEDUr6 JbMBa4flyK1OTxCQ== From: "tip-bot2 for Colin Ian King" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/urgent] futex: Return error code instead of assigning it without effect Cc: Colin Ian King , Thomas Gleixner , andrealmeid@collabora.com, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210818131840.34262-1-colin.king@canonical.com> References: <20210818131840.34262-1-colin.king@canonical.com> MIME-Version: 1.0 Message-ID: <163052451566.25758.7272209152781403112.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/urgent branch of tip: Commit-ID: 1f15eb89144fdd4c881ef7181d51e989a732f4f0 Gitweb: https://git.kernel.org/tip/1f15eb89144fdd4c881ef7181d51e989a73= 2f4f0 Author: Colin Ian King AuthorDate: Wed, 18 Aug 2021 14:18:40 +01:00 Committer: Thomas Gleixner CommitterDate: Wed, 01 Sep 2021 21:26:33 +02:00 futex: Return error code instead of assigning it without effect The check on the rt_waiter and top_waiter->pi_state is assigning an error return code to ret but this later gets re-assigned, hence the check is ineffective. Return -EINVAL rather than assigning it to ret which was the original intent. Fixes: dc7109aaa233 ("futex: Validate waiter correctly in futex_proxy_trylock= _atomic()") Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King Signed-off-by: Thomas Gleixner Reviewed-by: Andr=C3=A9 Almeida Link: https://lore.kernel.org/r/20210818131840.34262-1-colin.king@canonical.c= om --- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/futex.c b/kernel/futex.c index e7b4c61..30e7dae 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -2025,7 +2025,7 @@ futex_proxy_trylock_atomic(u32 __user *pifutex, struct = futex_hash_bucket *hb1, * and waiting on the 'waitqueue' futex which is always !PI. */ if (!top_waiter->rt_waiter || top_waiter->pi_state) - ret =3D -EINVAL; + return -EINVAL; =20 /* Ensure we requeue to the expected futex. */ if (!match_futex(top_waiter->requeue_pi_key, key2))