Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3852991pxb; Tue, 17 Nov 2020 05:25:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJxpSkgsjEGjuECfdc3iZJoKwYkhePtu8RBzRzdfVleGOA613q0miqhN39VA7ga3swUl3SzJ X-Received: by 2002:a50:bb26:: with SMTP id y35mr9095051ede.257.1605619545855; Tue, 17 Nov 2020 05:25:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605619545; cv=none; d=google.com; s=arc-20160816; b=jX6oVoMnJcbOll83GG+hsIEdlyNchSOKMhbrkyLWb2NFEGjwU8fziuTvS4J0aCStwP L2+C/y/GXvDY6uL4L8BZUgJ7N+b+kJ9nrc7/viwvpb/iuLGXPWC3rjgUWMHl1bz9SqWv whoLPs8cXknuo7dDolzvsgZx9srkBdjCLnyMtn9sClulIWx9wNfxu78OKM0yvYFe4fjX vizydDbZXoptH0YFfY1g1XMpOe5N1ql5AbXK6RGiXqNn7U2gAJLrwgSP1Sd8YSN12r1f JodwmmAxmpZ0kXYnsFOmokWGQfDTplxaj9eiMePwSeLUF36jJZRs8aFLJ/l8sV1/CRQC crwA== 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=BrW+C4Or0m0BSoO3QMqBkgrdf2pJMsuObxjnVTMglv4=; b=tBi46Qf6ZV0UDxU09AVMg3F+UJFPZzK7o6+Nt8ev2rZlk0S6b+EmFjAmfQo4w+rdqf 4KTAAlb+/2ftt0XsNA3GyAbJ7XLCKVuSUH8YyomCGG1zJYnudwPRvw4/2UU13odzF1Nd iFLBBf5A9LS7pAFETN28QldWPZzrM+hh7fuJ121P/ScFWMNnHulx/hCN6skwL33P70qA ynu4RY/NDDeZT1FDpALQr3tG6dqEyBCzUq7asPBcltcFh7U9jdoaWXghc3V6vIvghfyl D+8Z4QIGn5jFWylpFDhxGerSYd+BqPCL54q4D1usZkvD4l0pSNi3FoN1/+2BcuXqSxTp 5X5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nszBBY7F; 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 bc16si14212457edb.391.2020.11.17.05.25.23; Tue, 17 Nov 2020 05:25:45 -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=nszBBY7F; 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 S1730810AbgKQNVB (ORCPT + 99 others); Tue, 17 Nov 2020 08:21:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:54648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730817AbgKQNU5 (ORCPT ); Tue, 17 Nov 2020 08:20:57 -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 B657324654; Tue, 17 Nov 2020 13:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1605619257; bh=pQdsyDq0m77nWGYcxE5VeRNPamitsE1SmAC4DqC0lnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nszBBY7FefcFLFf/AwDIhPOI7SBxuud+G7ICpPEvwV8KKZKE2p/D3bb1fkk0iqVj8 rsB7aVu/K4xx/FLltg5w1XSveOv4o+XKHWRAJUuuUwJIWDrZE/L5KZj3+2ki1iEneF iS5rlxxTLla21VgsmztAyRw3InUgy3msJdVzoce0= 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.19 073/101] futex: Dont enable IRQs unconditionally in put_pi_state() Date: Tue, 17 Nov 2020 14:05:40 +0100 Message-Id: <20201117122116.673018980@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201117122113.128215851@linuxfoundation.org> References: <20201117122113.128215851@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 @@ -856,8 +856,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); @@ -865,7 +866,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) {