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 02757C9830E for ; Thu, 24 Sep 2026 16:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=GoSjlnae3EsMZE+evVJvGM8Or86X6uguw0HnaW+owzc=; b=dMPE/Mp/UOYb7CWG2iMW91zgvw 5KFLSCAPDGg9q2Jyi9SLNseydWk6n+WlAmUUY5EDa3d1zyn2tjfkO7zquTSqFH9xFOXdHB1xy4Xhw Pibzawxy4EoYlUWbFwnb8imv/8VsXl13489qC/Dm3hDJ2QUGmiwv8YNbUn4CjNpAKiwtKJZrYUJuS UGhR8n0bk6saRS4n2iXrq6NXEWpY175fKAPu3+M0rB4AzqR+Z1jvqzTPh678xLDlH9fPOZ8dzwB4q FCU2+0fqoNrvYjD+BbX6KxN+Ox9037rd3RMNWiJaspVu/ASabQUu437MWiMnY444buH4l5aiqfual lHSonIoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x9m6m-0000000BZMl-3ylL; Thu, 24 Sep 2026 16:15:40 +0000 Received: from out-70.mta0.migadu.com ([2001:41d0:1004:224b::46] helo=mta0.migadu.com) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x9m6c-0000000BZI9-3vtB for linux-arm-kernel@lists.infradead.org; Thu, 24 Sep 2026 16:15:33 +0000 X-Envelope-To: linux-arm-kernel@lists.infradead.org DKIM-Signature: a=rsa-sha256; bh=Gcr8hLNdqy1k42dqWVISdXk8rlCA5k+esFk5lI0c9bw=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1790266528; v=1; x=1790871328; b=JL33j6HmHVnLW12Ol2vofCR0nt/NadgzqC/PJ7yaOgUsLNA3y/0RUoy6iy7FoxVMurPuMw6J 63oMbKA1swJtmU6F1VhnX5rZBHNvdqXmkkoPoLgZr55pZidZGpL/MiiYoN8WKq7N7ye9HCDOxD4 OmORBOoStX1iq+NsY4L9gWNE= X-Envelope-To: linux-arm-kernel@lists.infradead.org Received: by smtp.migadu.com with ESMTPS id ed8d07410b9191b1; Thu, 24 Sep 2026 16:15:28 +0000 X-Mizu-Trace-ID: ed8d07410b9191b1 X-Migadu-Flow: FLOW_OUT From: Fuad Tabba To: Marc Zyngier , Thomas Gleixner Cc: Radu Rendec , James Morse , Will Deacon , Fuad Tabba , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] irqchip/gic-v3-its: Don't free the tables of an enabled ITS Date: Thu, 24 Sep 2026 17:15:13 +0100 Message-Id: <20260924161514.1112730-3-fuad.tabba@linux.dev> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20260924161514.1112730-1-fuad.tabba@linux.dev> References: <20260924161514.1112730-1-fuad.tabba@linux.dev> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260924_091531_117611_29F7CC8D X-CRM114-Status: GOOD ( 11.97 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org its_probe_one() enables the ITS before its_init_domain(), the last step that can fail, and the unwind from there frees the tables and the command queue without disabling it. The kernel comes up with an enabled ITS pointing at freed pages. Enable the ITS last. Nothing reaches the new domain before then: this runs from init_IRQ(), and the ITS joins its_nodes only after the enable. Fixes: 4c21f3c26ecc2 ("irqchip: GICv3: ITS: DT probing and initialization") Signed-off-by: Fuad Tabba --- drivers/irqchip/irq-gic-v3-its.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index 58e52095e6ea8..a5690721f0feb 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -5332,16 +5332,18 @@ static int __init its_probe_one(struct its_node *its) } gits_write_cwriter(0, its->base + GITS_CWRITER); + + err = its_init_domain(its); + if (err) + goto out_free_collection; + + /* Enable last: the unwind frees memory an enabled ITS may access */ ctlr = readl_relaxed(its->base + GITS_CTLR); ctlr |= GITS_CTLR_ENABLE; if (is_v4(its)) ctlr |= GITS_CTLR_ImDe; writel_relaxed(ctlr, its->base + GITS_CTLR); - err = its_init_domain(its); - if (err) - goto out_free_collection; - raw_spin_lock(&its_lock); list_add(&its->entry, &its_nodes); raw_spin_unlock(&its_lock); -- 2.39.5