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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0EE7BC4332F for ; Fri, 9 Dec 2022 14:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=PPI/EUYPyRSSvD92Ffvz5Ct90oaJ++mDeU6uyjSXd0Y=; b=AFOF8NKWdn4qBD NrVQJBJMNlRtVwAXN+vin/zwcq49HT/ow2Cnch0/ADc/NJRZDHaO++PCTsXAHCG1BlXQWczUnYM+P q1iC7NI4nbepADaFR3CKFaYYNU/LyTUqtYjA6o+AA0VieLXTrS8l7xdXUhl2czziHSGG4AdoC9mI8 DHFGoubQUQFEGKTp/RrEYV20PC19Ukmgl8us+5GUuyfAGlOoqL/xFvrjczWhCZQu4IelFu7sd3lBD n8HjbLv51BeP23Q5a+5CMfU5lSY8xMZ/faxDY4I0bmX5xb6h2rlMw5yc/4Txwjh/v6u1dELyepitP z51hTLE8UPXnrzyUDRfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3e0C-008DmZ-FQ; Fri, 09 Dec 2022 14:05:24 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3e03-008Dan-NQ for linux-arm-kernel@lists.infradead.org; Fri, 09 Dec 2022 14:05:18 +0000 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 A9C5D6226E; 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 ) id 1p3e0I-0000RZ-Hc; Fri, 09 Dec 2022 15:05:30 +0100 From: Johan Hovold To: Marc Zyngier Cc: Thomas Gleixner , 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221209_060515_824319_3D4FB2CD X-CRM114-Status: GOOD ( 13.14 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 --- 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, -- 2.37.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel