From: Frank Li <Frank.li@oss.nxp.com>
To: Zhipeng.wang_1@oss.nxp.com
Cc: Thomas Gleixner <tglx@kernel.org>, Marc Zyngier <maz@kernel.org>,
Frank Li <Frank.Li@nxp.com>, Radu Rendec <radu@rendec.net>,
Sascha Hauer <s.hauer@pengutronix.de>,
Pengutronix Kernel Team <kernel@pengutronix.de>,
Fabio Estevam <festevam@gmail.com>,
Jindong Yue <jindong.yue@nxp.com>,
xuegang.liu@nxp.com, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v5 3/9] irqchip/imx-irqsteer: Validate IRQ count before creating domain
Date: Fri, 21 Aug 2026 09:24:52 -0500 [thread overview]
Message-ID: <aohftK95_iDsTPPm@SMW015318> (raw)
In-Reply-To: <20260821101039.4037925-4-Zhipeng.wang_1@oss.nxp.com>
On Fri, Aug 21, 2026 at 07:10:33PM +0900, Zhipeng.wang_1@oss.nxp.com wrote:
> From: Fabio Estevam <festevam@nabladev.com>
>
> The IRQ count is validated after creating the IRQ domain. If it is
> invalid, probe returns without removing the domain, leaving its host
> data pointing at devm-managed memory that is freed on probe failure.
>
> Validate the count before allocating resources to avoid the leak and
> dangling pointer.
>
> Fixes: 28528fca4908 ("irqchip/imx-irqsteer: Add multi output interrupts support")
> Signed-off-by: Fabio Estevam <festevam@nabladev.com>
> Signed-off-by: Zhipeng Wang <zhipeng.wang_1@nxp.com>
> ---
This patch should be second patch. After move to second patch, some error
handle will be nice to have.
your 3 patch needn't because no error after it. change to devm_ version
will be improvement patch and put after new API added.
Frank
> drivers/irqchip/irq-imx-irqsteer.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/irqchip/irq-imx-irqsteer.c b/drivers/irqchip/irq-imx-irqsteer.c
> index c1df84551efa..571324de8bd1 100644
> --- a/drivers/irqchip/irq-imx-irqsteer.c
> +++ b/drivers/irqchip/irq-imx-irqsteer.c
> @@ -218,6 +218,8 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> */
> data->irq_count = DIV_ROUND_UP(irqs_num, 64);
> data->reg_num = irqs_num / 32;
> + if (!data->irq_count || data->irq_count > CHAN_MAX_OUTPUT_INT)
> + return -EINVAL;
>
> if (IS_ENABLED(CONFIG_PM)) {
> data->saved_reg = devm_kzalloc(&pdev->dev,
> @@ -253,11 +255,6 @@ static int imx_irqsteer_probe(struct platform_device *pdev)
> }
> irq_domain_set_pm_device(data->domain, &pdev->dev);
>
> - if (!data->irq_count || data->irq_count > CHAN_MAX_OUTPUT_INT) {
> - ret = -EINVAL;
> - goto out;
> - }
> -
> for (i = 0; i < data->irq_count; i++) {
> data->irq[i] = irq_of_parse_and_map(np, i);
> if (!data->irq[i])
> --
> 2.34.1
>
>
next prev parent reply other threads:[~2026-08-21 14:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 10:10 [PATCH v5 0/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 1/9] irqchip/imx-irqsteer: Call chained_irq_exit() on the handler error path Zhipeng.wang_1
2026-08-21 14:15 ` Frank Li
2026-08-29 20:54 ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 2/9] irqchip/imx-irqsteer: Use devm to manage the IRQ domain Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 3/9] irqchip/imx-irqsteer: Validate IRQ count before creating domain Zhipeng.wang_1
2026-08-21 14:24 ` Frank Li [this message]
2026-08-24 9:38 ` Zhipeng Wang (OSS)
2026-08-24 12:49 ` Fabio Estevam
2026-08-26 3:26 ` Zhipeng Wang (OSS)
2026-08-21 10:10 ` [PATCH v5 4/9] irqchip/imx-irqsteer: Dispose of parent IRQ mappings in remove() Zhipeng.wang_1
2026-08-30 16:30 ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 5/9] irqchip/imx-irqsteer: Mask all interrupts in probe() Zhipeng.wang_1
2026-08-30 18:51 ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 6/9] irqchip/imx-irqsteer: Let devres own the clock and runtime PM Zhipeng.wang_1
2026-08-21 10:26 ` sashiko-bot
2026-08-26 5:53 ` Zhipeng Wang (OSS)
2026-08-30 19:31 ` Radu Rendec
2026-08-31 8:30 ` Zhipeng Wang (OSS)
2026-08-21 10:10 ` [PATCH v5 7/9] irqchip/imx-irqsteer: Allow building as module Zhipeng.wang_1
2026-08-21 10:26 ` sashiko-bot
2026-09-03 1:16 ` Radu Rendec
2026-08-21 10:10 ` [PATCH v5 8/9] genirq/irqdomain: Add devm_irq_domain_create_linear() Zhipeng.wang_1
2026-08-21 10:10 ` [PATCH v5 9/9] irqchip/imx-irqsteer: Use devm_irq_domain_create_linear() Zhipeng.wang_1
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=aohftK95_iDsTPPm@SMW015318 \
--to=frank.li@oss.nxp.com \
--cc=Frank.Li@nxp.com \
--cc=Zhipeng.wang_1@oss.nxp.com \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=jindong.yue@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=radu@rendec.net \
--cc=s.hauer@pengutronix.de \
--cc=tglx@kernel.org \
--cc=xuegang.liu@nxp.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.