Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3849345pxb; Tue, 17 Nov 2020 05:20:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJwt08R206I7KTd4YMfW+MqGQ0pbAV9efB/NPq2CZkEyPQr7y5VFV5J2nSgYVmMwPuJQ7ASl X-Received: by 2002:a17:906:af49:: with SMTP id ly9mr19387415ejb.238.1605619232594; Tue, 17 Nov 2020 05:20:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619232; cv=none; d=google.com; s=arc-20160816; b=IV9a35gBbspW8Yo1v7nJOw06X5eENvpyfg+V3PBaTWh9QJ46mZWGSkPBjbhMz1/vX9 K72BcbsNDnrbEm6+RDWxbhiuhVkR8noA1OICfqDpzRnOwSzspmvVRp02YTDxtsYVSHEw qvG1WNhXAXcOTFVoRLAwACE66ZZ21XW/dhzJiF1FBvQ7qAYsNjl27S9SWIhIFCvS6Eia kCadCsXv3XLCZ4MUd/oCdUmFgM3FoDSTYZCbqNRTSZpqB4pJPqddbtsPBHeWZGj+61fZ bJlqhqfSDpqWv4seQ3NNTbHPci++oaABZm72Qi5AoPyIhdgzF5+rom1Aat2o0jKf97bW Ehxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hVqWWp5EvnTiwdm/C3WEpoVcMUCUcY2MoN6z6yGp1ik=; b=FBm9j59XtXZi4eh2OjDqMm/BgtgLcA+fE35+IPPNKjnbrJQMKW/Erc1arAqIlmu7KC iL5x0W6vJ//s6BATuTzziR7SgY4gUT/jJeB53cZTdlo8w8sb3LuLmYC5E2D5eNirp3mE 1i8xlNQQBi8ogwUQ2jvndFpi3Ykv8/i8M4GY89qCOP4MOfo+O8c0MC5XtZm4ThdWsi01 P5gasV4p1GtUz4D6T41GgRHE2/DXkEVhuWlSJwdeW5zbcAkjJcdNIEVfxfiXp1oqepnQ LU8jXBKuTjjePCUZX9yAlLpezp6FEMz18ZN483NAqkYlQlbV/9UL52DJAmjU9sxAb9By OVgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Dcz1FW8C; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f13si13995229edx.450.2020.11.17.05.20.09; Tue, 17 Nov 2020 05:20:32 -0800 (PST) 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=@kernel.org header.s=default header.b=Dcz1FW8C; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730177AbgKQNPX (ORCPT + 99 others); Tue, 17 Nov 2020 08:15:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:46372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729619AbgKQNPL (ORCPT ); Tue, 17 Nov 2020 08:15:11 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 51A5D2151B; Tue, 17 Nov 2020 13:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605618911; bh=OtI9tf6XW0TUEG9IyE0w34zCVQ3hCGoM5zEvrZjH3es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dcz1FW8CRK+J/I+BZ+8ivdWCfJyqagQDKQodfp4yJwVXkmDc59jZR0dY1a/npUZ0O nGy5+f3ciDFmDbI5MiKU7JPf0b8WAKL2dN06deZPo5nbIc6oKoQc6sAX+SzloG8hbr FhS9T2hqt+YJ2iPS1xlDeFRi14HH+9nLV1wlcp2g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Thomas Gleixner , "Peter Zijlstra (Intel)" Subject: [PATCH 4.14 50/85] futex: Dont enable IRQs unconditionally in put_pi_state() Date: Tue, 17 Nov 2020 14:05:19 +0100 Message-Id: <20201117122113.485126150@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122111.018425544@linuxfoundation.org> References: <20201117122111.018425544@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit 1e106aa3509b86738769775969822ffc1ec21bf4 upstream. The exit_pi_state_list() function calls put_pi_state() with IRQs disabled and is not expecting that IRQs will be enabled inside the function. Use the _irqsave() variant so that IRQs are restored to the original state instead of being enabled unconditionally. Fixes: 153fbd1226fb ("futex: Fix more put_pi_state() vs. exit_pi_state_list() races") Signed-off-by: Dan Carpenter Signed-off-by: Thomas Gleixner Acked-by: Peter Zijlstra (Intel) Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20201106085205.GA1159983@mwanda Signed-off-by: Greg Kroah-Hartman --- kernel/futex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -862,8 +862,9 @@ static void put_pi_state(struct futex_pi */ if (pi_state->owner) { struct task_struct *owner; + unsigned long flags; - raw_spin_lock_irq(&pi_state->pi_mutex.wait_lock); + raw_spin_lock_irqsave(&pi_state->pi_mutex.wait_lock, flags); owner = pi_state->owner; if (owner) { raw_spin_lock(&owner->pi_lock); @@ -871,7 +872,7 @@ static void put_pi_state(struct futex_pi raw_spin_unlock(&owner->pi_lock); } rt_mutex_proxy_unlock(&pi_state->pi_mutex, owner); - raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock); + raw_spin_unlock_irqrestore(&pi_state->pi_mutex.wait_lock, flags); } if (current->pi_state_cache) {