Message ID | 20221209140150.1453-6-johan+linaro@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp794302wrr; Fri, 9 Dec 2022 06:06:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf654yEa9xvES7JbFUuJf1n0wuax5c+g8SkEXEetNrGM0tqlde3+MA5/suKxIDEeSkWdPxRO X-Received: by 2002:a05:6a20:2aa4:b0:a5:2a8f:4328 with SMTP id v36-20020a056a202aa400b000a52a8f4328mr11668134pzh.23.1670594781155; Fri, 09 Dec 2022 06:06:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670594781; cv=none; d=google.com; s=arc-20160816; b=he+C9MShICGId6OBzbWIsxyhzfusDk8AYeuRZ9n36LQhT0CqlkzvLG1+yz/LtCu6YI /NYf1K5ATXl50sYnA0jMZpuJg4PwYpxPzd0A3Qdi93n6H4909oCdN9TeynAt7ZHYH8XP jUHHQhNI/u9bJUUTuOAf36w2DczATOe2xHepByuvAXFNHtI3JDTBicBMwZ+zR9tyGu9o 6sjpYuM/2inEBA1M9y4iVXmju7S1noBBjEEfe5w6SYlFAE82pmFNlZwllothk7cw2LfO IqYfscS732rT7AOzc8EnxMVMorDad+XYAQGopA8ueBlzB0BQtAn7uSnG5HO3CI07orRW dWsw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4WadEyHKseQUVT0rB9PWSL7cW80vRQIVKerL5ejOPSM=; b=tk6Svx9UDSYZbsOwoBJSMDxQ53P4tVLVOT2QYT4ShJ7L4hHh56aj8zkCIS94MfO+Ef tGUDy+6SmdwuTdD385eZW3JKb3s6He8W5hSs9SbzK9lLgI/O6i4aJsfrB81W4f16B2NV f0BUuzhkJaWvSeRIRDsuFt0AJeXRPEqCIoSsaDog3/yHcTXzFBNFDZHhT08luggJfWlo 5bHFuAFdCatQCgQ5/LVv3uk4hyYWkuE0mBh0Izd34XSJAgT7s4t+tqizY48L9OthaE1/ T50YZPnY2roBfeIbKqhtHwKH/0yvh6xufGHDYHKlHvWv2ZUFqTdRlEYb3bbf7/6I710S Pg7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=apXAddBP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z37-20020a630a65000000b004751c9dcf62si1502338pgk.509.2022.12.09.06.05.53; Fri, 09 Dec 2022 06:06:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=apXAddBP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229965AbiLIOFV (ORCPT <rfc822;sophiezhao968@gmail.com> + 99 others); Fri, 9 Dec 2022 09:05:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbiLIOFQ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 9 Dec 2022 09:05:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A23C97721E; Fri, 9 Dec 2022 06:05:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1ED8162268; Fri, 9 Dec 2022 14:05:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78CA4C433A4; Fri, 9 Dec 2022 14:05:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670594713; bh=qRyAyv7DCxYIOlxXXpgDgiVYhhrQXHLZUca0t02tYg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=apXAddBPyF6ckd0fDxOBEFwwBJ2g70bsaR1CLhiYv+piyP9cSESieLYxOYZxSrJvW m1dHEWfEiXxuRJyQXw8FpL00gTyyam2gdB3keU9cyqNIGIKWwTKrxE0/e0OiTbahoQ h31gMUBYiyEplfhe1FdMbzi4e1F0ELhItaHiJ5/1tdHOqjl9wBm+vkXNIAaI3CiJjG weMap5GGQzy1lCDTA6rQx4w5/ILV9iqO6kWfr9pfi1f5CyOrIeD6QyiqmlTrwImOhd n3H524YFaH8qYx5qu3hAm8KRGhGIxOBNbJBEIeio4awfyrwuyJcYmvSOefJot3OYLV +vEGZ+Lxh0bFA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from <johan+linaro@kernel.org>) id 1p3e0I-0000RZ-Hc; Fri, 09 Dec 2022 15:05:30 +0100 From: Johan Hovold <johan+linaro@kernel.org> To: Marc Zyngier <maz@kernel.org> Cc: Thomas Gleixner <tglx@linutronix.de>, x86@kernel.org, platform-driver-x86@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold <johan+linaro@kernel.org> Subject: [PATCH v3 05/19] irqdomain: Fix disassociation race Date: Fri, 9 Dec 2022 15:01:36 +0100 Message-Id: <20221209140150.1453-6-johan+linaro@kernel.org> X-Mailer: git-send-email 2.37.4 In-Reply-To: <20221209140150.1453-1-johan+linaro@kernel.org> References: <20221209140150.1453-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751745593266484753?= X-GMAIL-MSGID: =?utf-8?q?1751745593266484753?= |
Series |
irqdomain: fix mapping race and clean up locking
|
|
Commit Message
Johan Hovold
Dec. 9, 2022, 2:01 p.m. UTC
The global irq_domain_mutex is held when mapping interrupts from
non-hierarchical domains but currently not when disposing them.
This specifically means that updates of the domain mapcount is racy
(currently only used for statistics in debugfs).
Make sure to hold the global irq_domain_mutex also when disposing
mappings from non-hierarchical domains.
Fixes: 9dc6be3d4193 ("genirq/irqdomain: Add map counter")
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
---
kernel/irq/irqdomain.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index b2087f55a1ac..23f5919e58b7 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -537,6 +537,9 @@ static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq) return; hwirq = irq_data->hwirq; + + mutex_lock(&irq_domain_mutex); + irq_set_status_flags(irq, IRQ_NOREQUEST); /* remove chip and handler */ @@ -556,6 +559,8 @@ static void irq_domain_disassociate(struct irq_domain *domain, unsigned int irq) /* Clear reverse map for this hwirq */ irq_domain_clear_mapping(domain, hwirq); + + mutex_unlock(&irq_domain_mutex); } static int __irq_domain_associate(struct irq_domain *domain, unsigned int virq,