mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peng Fan <peng.fan@linux.dev>
To: Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	 Frank Li <Frank.Li@nxp.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	 Pengutronix Kernel Team <kernel@pengutronix.de>,
	 Fabio Estevam <festevam@gmail.com>,
	Shengjiu Wang <shengjiu.wang@nxp.com>,
	 Marc Zyngier <maz@kernel.org>
Cc: linux-kernel@vger.kernel.org, imx@lists.linux.dev,
	 linux-arm-kernel@lists.infradead.org,
	Peng Fan <peng.fan@nxp.com>
Subject: [PATCH v2 6/8] irqchip/imx-intmux: Don't WARN on malformed interrupt specifiers
Date: Thu, 03 Dec 2026 17:29:18 +0800	[thread overview]
Message-ID: <20261203-imx-intmux-v2-6-a6db1eed3b5f@nxp.com> (raw)
In-Reply-To: <20261203-imx-intmux-v2-0-a6db1eed3b5f@nxp.com>

From: Peng Fan <peng.fan@nxp.com>

The xlate callback validates the interrupt specifier cells, but uses
WARN_ON() for checks that can be triggered by user-supplied device tree
data. A malformed specifier is an expected, recoverable error, so the
WARN only floods the log.

Return -EINVAL without the splat. Also reject source numbers beyond the
32 inputs of a channel instead of letting the association hit the WARN
in irq_domain_associate_locked().

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/irqchip/irq-imx-intmux.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-imx-intmux.c b/drivers/irqchip/irq-imx-intmux.c
index a9c554eba958..369132b4677b 100644
--- a/drivers/irqchip/irq-imx-intmux.c
+++ b/drivers/irqchip/irq-imx-intmux.c
@@ -145,10 +145,13 @@ static int imx_intmux_irq_xlate(struct irq_domain *d, struct device_node *node,
 	 * the 1st cell: hw interrupt number
 	 * the 2nd cell: channel index
 	 */
-	if (WARN_ON(intsize != 2))
+	if (intsize != 2)
 		return -EINVAL;
 
-	if (WARN_ON(intspec[1] >= data->channum))
+	if (intspec[0] >= 32)
+		return -EINVAL;
+
+	if (intspec[1] >= data->channum)
 		return -EINVAL;
 
 	*out_hwirq = intspec[0];

-- 
2.56.0


  parent reply	other threads:[~2026-12-03  9:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  9:29 [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan
2026-12-03  9:29 ` [PATCH v2 1/8] irqchip/imx-intmux: Don't create parent mappings while counting channels Peng Fan
2026-12-03  9:29 ` [PATCH v2 2/8] irqchip/imx-intmux: Dispose IRQ mappings on remove Peng Fan
2026-12-03  9:29 ` [PATCH v2 3/8] irqchip/imx-intmux: Fix probe error path Peng Fan
2026-12-03  9:29 ` [PATCH v2 4/8] irqchip/imx-intmux: Reject zero channel count Peng Fan
2026-12-03  9:29 ` [PATCH v2 5/8] irqchip/imx-intmux: Mark input interrupts as level-triggered Peng Fan
2026-12-03  9:29 ` Peng Fan [this message]
2026-12-03  9:29 ` [PATCH v2 7/8] irqchip/imx-intmux: Use devm_irq_domain_create_linear() Peng Fan
2026-12-03  9:29 ` [PATCH v2 8/8] irqchip/imx-intmux: Factor out imx_intmux_teardown_channel() Peng Fan
2026-12-03 14:14 ` [PATCH v2 0/8] irqchip/imx-intmux: Fix and modernize resource management Peng Fan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203-imx-intmux-v2-6-a6db1eed3b5f@nxp.com \
    --to=peng.fan@linux.dev \
    --cc=Frank.Li@nxp.com \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maz@kernel.org \
    --cc=peng.fan@nxp.com \
    --cc=radu@rendec.net \
    --cc=s.hauer@pengutronix.de \
    --cc=shengjiu.wang@nxp.com \
    --cc=tglx@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®