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=1796291592; b=SUU7RdpOt+DOO5T+8h8fCO1+z1+w733/mGxUecHU73VYBrGqcFtRGUUbEkkWFNNiA7vv XUnyg2dxBEwAGmaWZTrHWi1z5cVgRk52cvl69fQIGgZ3+bY6pBQYqhWG4SRZ+cBNPmTvz NMlsz/LmezPw8sqrKLbsiHiBcfTi8nQ+adWBU7KcpbLfJ08bia6b1YxKra1oCnChEJ83W 3leL9bIXTG7ev3CLUXbx0YzQiDhK9x7k8CZdfWrpp9EPJso/rKN9QjNXC8m933IfLMTN6 J+4Et4NEYcQAITMiUfLFT/CbuGMQ2q4j/dybp+1Fc5ZmotTWVZgcBBKJr+9QTnRzKrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796291592; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=GFRkXMWAUn1u5AStEVXaRNExTW5DBS2MK82GOP/XIHM=; b=5F6Hw+FJY6NEMpTleaIYLFC/8MUw7MAa4hSvXtbM2WlL5G1I56nF1Pd19sDPhq9aV+Zy ZHTnOiultuov/RNaUEY/Geak0CBBzD0CzwNDparRWRGMme8VfvI7uP4y1D39e4H08iB3y S/jjRlvbRuoey6rYCr1mdLxJz0WHnoIr4VlFpkDbFmxXe8RkwPudHrWhV2Ye3QLtBZuFe rOWpW+4tYrUlcnh3JXGe61TbMbtRTZ9RirSb1Tf9icHI6H999R3V1rZMqjiqYzXGkL8cF lrNGXLAJZyThmJBYFCn3ieI4iVj8PpVxhGEr57DOqGWoJJ0VETgI7tLRc5rLRh7twdA== 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=Tutv6psY; 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 52E0F606A32F for ; Thu, 3 Dec 2026 09:53:12 +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=Tutv6psY Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1E541F000C1; Thu, 3 Dec 2026 09:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796291591; bh=GFRkXMWAUn1u5AStEVXaRNExTW5DBS2MK82GOP/XIHM=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Tutv6psYWyhEWkq08sYsQ/ooD7I8dd2h5rTAGQJBofM1HbGyXveGd3ob01osLd7QR uE9JVCPGTK2SznTcgmXCRBT3NFbYU37NB9vkBNI1y9jCe6/KBbzYo1+Nl7CvunxzYR i5wCWio0ByJpdrnjIDXX08c+VfEXu8EXeE3LZcyVgern9gh9tF/FPhG3PdQTMILIQh udpLnn8p0YyHf3ZB1ddPcZnYB0XY0br+2hzPf8OTXpVFxS0Tr043+XEotuMKDnNwck QPT2/xIF2dDQPmkT1WIaeV9G5/fiVcPdl44MsQJmyB5OtDbZo77X8Lg8xuCotjQE9i C7bH9ndnvItig== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove 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-2-a6db1eed3b5f@nxp.com> References: <20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com> <20261203-imx-intmux-v2-2-a6db1eed3b5f@nxp.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 09:53:11 +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 3 potential issues to consider: - [Medium] irqchip/imx-intmux: lazy disable_irq() leaves race in imx_intmux_remove() - [Medium] irqchip/imx-intmux: lazy disable_irq() leaves parent IRQ unmasked on remove - [Low] irqchip/imx-intmux: commit message cites old irq_of_parse_and_map() -- commit ba79cdc897e9950cf9db9d3877c7ec4b69f3800c Author: Peng Fan irqchip/imx-intmux: Dispose IRQ mappings on remove This commit masks and unchains each INTMUX channel's parent interrupt, disposes the 32 child IRQ mappings before removing the channel domain, and releases the parent IRQ mapping on driver removal. > The driver removes its IRQ domains without disposing the mappings > created for their 32 input lines, and it never releases the parent > IRQ mappings obtained with irq_of_parse_and_map(). [Severity: Low] Commit "irqchip/imx-intmux: Don't create parent mappings while counting channels" already replaced irq_of_parse_and_map() with of_irq_get() in imx_intmux_probe(). Should this refer to of_irq_get() instead? > diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-i= ntmux.c > index 7552a3d0c3695..3b4eb9bd6678b 100644 > --- a/drivers/irqchip/irq-imx-intmux.c > +++ b/drivers/irqchip/irq-imx-intmux.c > @@ -296,10 +296,19 @@ static void imx_intmux_remove(struct platform_devic= e *pdev) > /* disable all interrupt sources of this channel */ > if (ret >=3D 0) > writel_relaxed(0, data->regs + CHANIER(i)); > + /* > + * Mask the parent interrupt and wait for a handler that is > + * already running to finish before its data and mappings are > + * torn down. > + */ > + disable_irq(data->irqchip_data[i].irq); > irq_set_chained_handler_and_data(data->irqchip_data[i].irq, > NULL, NULL); > - > + 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); [Severity: Medium] Can disable_irq() leave the parent GICv3 interrupt unmasked in hardware and allow imx_intmux_irq_handler() to race with teardown? On i.MX8 platforms using this driver, the parent controller is GICv3, where neither gic_chip nor gic_eoimode1_chip implements .irq_disable. Without IRQ_DISABLE_UNLAZY, disable_irq() calls __irq_disable(desc, false), which only sets IRQD_IRQ_DISABLED in software and skips mask_irq(). CPU0 CPU1 imx_intmux_remove() disable_irq(irq) __irq_disable(desc, false) synchronize_irq(irq) irq_set_chained_handler_and_data(...) ...handler_data =3D NULL imx_intmux_irq_handler() irqchip_data =3D ...handler_data idx =3D irqchip_data->chanidx <-- NULL pointer dereference __irq_do_set_handler(..., NULL) Because imx_intmux_irq_handler() is a chained handler, it runs without desc->lock or checking irqd_irq_disabled(). If a parent SPI fires after disable_irq() returns (for example when pm_runtime_resume_and_get() fails so CHANIER(i) is not cleared, or while writel_relaxed(0, ...) is still posted), CPU1 can dereference a NULL irqchip_data or continue running against the freed irq_domain after irq_domain_remove(). irq_set_chained_handler_and_data(..., NULL, NULL) masks the parent line only after clearing handler_data and does not synchronize afterward, and the trailing irq_dispose_mapping() installs no_irq_chip before its synchronize_irq(), losing the GIC active-state check. Setting IRQ_DISABLE_UNLAZY on the parent IRQ before disable_irq() would force __irq_disable() to mask the GICv3 line in hardware before synchronize_irq() runs. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-imx-intmux= -v2-0-a6db1eed3b5f@nxp.com?part=3D2