From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796291722; b=yOl9+JmohSMU2P96NW0uUY2jO6I4BWIj7jsU7fDrpCC43BP4QG89/+ookoR5bQKlJZlc Tw4rWmIFHFlGaOiReiHoPTB1sH4uuoy4R+Rn1kZ2OroHJcUMUkslz2nsvsg/VRsQ4IvtX v+lWuGUmoHmuPPCnSxGgOODq3hfiw8FcNYwoZ8r9fpPVJw4OEOTsy7iYHzjI8lJLmmHRx A8pOsqdevoD2gz6atiaXXGDbpXMwFoAOPgoZ4Z+GKz0EODXZ7FQtbSMcPiwL3ciXaAWaZ hTdOAf6OBiSmbxLThWDNwPfkPeRWq0lzfUExA4KetFtN6eRgKKkqjl/OcheKw4Wsyuw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796291722; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=RT6buNhPhVzHDEVbFJyVx7sIZehP9ngaM6E1RBQe2yQ=; b=RtKfeLQNrzUql++7Y81MNQLzu14/fPd1Yw1n4Zx9bUqT85EyzTaGRmM5SMdoGBPo2zP2 D9YBRH9pEbhGMMv8mNmK6PfSI+uWF9K4DGmIX7s0+izFQiV4j9C0Gh/go5uphV9SjlonV ugtQzHAx7NDRVj1w1q+z0recEBm7Mkp39sJZXjKZLt/UhAYYv0PJ+yUV26RDuz9rgUSNO pw8EyzjrfJvPoNChmcLqED+6nLN0LiQq7HY7HOX7WjgXpHHx2YkqERi5orCdUEg/XSEjD EptYs7qReBxYJ/Vy62kJU42qEWi5dXsFkpKoTziay1cCyxjSsZCsTm6zrghI3IYEYSQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lS7k3JtJ; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4ACE9606A322 for ; Thu, 3 Dec 2026 09:55:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=lS7k3JtJ Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF2C71F000C1; Thu, 3 Dec 2026 09:55:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796291721; bh=RT6buNhPhVzHDEVbFJyVx7sIZehP9ngaM6E1RBQe2yQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=lS7k3JtJMyfZ39MCRv9N7CHsKuspipxefyFSA6vNKsZo2abJDIDW4y+Y8ep/QjtFt +CQhQ9ltMJlA0PKKyhtSsuJe/Zixi3gNeb1GJ3QjOstSarTxqfvHK4LLx7VGxDBa3B jy6XZI3LYbDo+c0RmJ53XnP87LAEQ5nczFDq1ETerQgp6I4hpxM+CGNXgIgVKItDQ1 NNA1X3t6KDxiRxNMf8VKMrTfEzuKXlg7DsxUfsq5HfG2ezHh6QaBiRykavYuKZ6eUV TVtjq9ubI68r33IEPPR+UeC7joOl5pF9NKl9T9Jwc9UaRmdD6asUUShFZNcOTjStgT PelmEikSjvtDg== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Reply-To: sashiko-reviews@lists.linux.dev To: "Peng Fan" Cc: imx@lists.linux.dev, Frank.Li@kernel.org In-Reply-To: <20261203-imx-intmux-v2-7-a6db1eed3b5f@nxp.com> References: <20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com> <20261203-imx-intmux-v2-7-a6db1eed3b5f@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:55:21 +0000 X-Mailing-List: imx@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] irqchip/imx-intmux: devm_irq_domain_create_linear() inverts clock/PM teardown -- commit 7858358f254863ea504bc6fe05b47317cf04b64e Author: Peng Fan irqchip/imx-intmux: Use devm_irq_domain_create_linear() This commit switches per-channel IRQ domain creation to devm_irq_domain_create_linear() and removes the explicit irq_domain_remove() calls from the probe error path and imx_intmux_remove(). > diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-i= ntmux.c > index 369132b4677ba..eeba45f312be9 100644 > --- a/drivers/irqchip/irq-imx-intmux.c > +++ b/drivers/irqchip/irq-imx-intmux.c > @@ -260,8 +260,9 @@ static int imx_intmux_probe(struct platform_device *p= dev) > goto out; > } > =20 > - domain =3D irq_domain_create_linear(of_fwnode_handle(np), 32, &imx_int= mux_domain_ops, > - &data->irqchip_data[i]); > + domain =3D devm_irq_domain_create_linear(&pdev->dev, dev_fwnode(&pdev-= >dev), 32, > + &imx_intmux_domain_ops, > + &data->irqchip_data[i]); > if (!domain) { > ret =3D -ENOMEM; > dev_err(&pdev->dev, "failed to create IRQ domain\n"); > @@ -301,7 +302,6 @@ static int imx_intmux_probe(struct platform_device *p= dev) > for (unsigned int hwirq =3D 0; hwirq < 32; hwirq++) > irq_dispose_mapping(irq_find_mapping(data->irqchip_data[i].domain, > hwirq)); > - irq_domain_remove(data->irqchip_data[i].domain); > irq_dispose_mapping(data->irqchip_data[i].irq); > } > pm_runtime_disable(&pdev->dev); > @@ -335,7 +335,6 @@ static void imx_intmux_remove(struct platform_device = *pdev) > for (unsigned int hwirq =3D 0; hwirq < 32; hwirq++) > irq_dispose_mapping(irq_find_mapping(data->irqchip_data[i].domain, > hwirq)); > - irq_domain_remove(data->irqchip_data[i].domain); > irq_dispose_mapping(data->irqchip_data[i].irq); > } > =20 [Severity: Medium] Can deferring irq_domain_remove() to devres leave the channel IRQ domains published after child mappings, runtime PM, and ipg_clk have already been torn down? Both the probe error path and imx_intmux_remove() dispose child mappings, call pm_runtime_disable(), and call clk_disable_unprepare(data->ipg_clk) before returning to the driver core. The channel domains stay on irq_domain_list until device_unbind_cleanup() runs devres_release_all(). When fw_devlink=3Doff or fw_devlink=3Dpermissive is in effect, a consumer c= an resolve an interrupt in that window after the disposal loop has finished: CPU0 CPU1 imx_intmux_remove() irq_dispose_mapping(...) pm_runtime_disable() clk_disable_unprepare(ipg_clk) of_irq_get() irq_create_of_mapping() device_unbind_cleanup() devres_release_all() irq_domain_remove(domain) kfree(data) request_irq() ... imx_intmux_irq_unmask() <-- use-after-free irq_domain_remove() frees the domain without disposing entries in the linear revmap array, and devres then frees data, leaving the new irq_desc with dangling domain and chip_data pointers. If CONFIG_PM is disabled, irq_chip_pm_get() also returns 0, allowing a concurrent request_irq() in that window to call imx_intmux_irq_unmask() and access CHANIER(idx) after ipg_clk has been disabled. Either keeping explicit irq_domain_remove() before pm_runtime_disable() and clk_disable_unprepare(), or managing ipg_clk and runtime PM via devres registered before devm_irq_domain_create_linear() (as irq-imx-irqsteer.c does), would preserve reverse teardown order. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-imx-intmux= -v2-0-a6db1eed3b5f@nxp.com?part=3D7