From: Dan Carpenter <error27@gmail.com>
To: christian.taedcke@weidmueller.com
Cc: Vinod Koul <vkoul@kernel.org>, Frank Li <Frank.Li@kernel.org>,
christian.taedcke-oss@weidmueller.com, dmaengine@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v3] dmaengine: nbpfaxi: Fix setting channel irqs in probe()
Date: Thu, 9 Jul 2026 13:38:50 +0300 [thread overview]
Message-ID: <ak96OkpYvJrK1Vbt@stanley.mountain> (raw)
In-Reply-To: <20260703-upstreaming-nbpfaxi-v1-v3-1-24f7f9aa102f@weidmueller.com>
On Fri, Jul 03, 2026 at 09:56:12AM +0200, Christian Taedcke via B4 Relay wrote:
> From: Christian Taedcke <christian.taedcke@weidmueller.com>
>
> When one irq is used for errors and each channel gets a dedicated irq,
> the total number of irqs is num_channels + 1. If the error irq is not
> the last entry in irqbuf[] but an earlier one, the loop assigning
> per-channel irqs terminates one iteration too early and the last
> channel is left without an irq.
>
> Iterate over all collected irqs instead of num_channels so the
> error-irq skip does not shorten the effective channel count.
>
> Fixes: 188c6ba1dd92 ("dmaengine: nbpfaxi: Fix memory corruption in probe()")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
> ---
> Changes in v3:
> - Guard against out-of-bound writes to chan in case of an invalid eirq.
> - Link to v2: https://patch.msgid.link/20260702-upstreaming-nbpfaxi-v1-v2-1-e6d6b178a278@weidmueller.com
>
> Changes in v2:
> - Advance chan only when assigning a real irq to fix out-of-bounds
> memory access.
> - Remove now redundant ARRAY_SIZE(irqbuf) check.
> - Link to v1: https://patch.msgid.link/20260702-upstreaming-nbpfaxi-v1-v1-1-fd8ea8830cea@weidmueller.com
>
> To: christian.taedcke-oss@weidmueller.com
> To: Vinod Koul <vkoul@kernel.org>
> To: Frank Li <Frank.Li@kernel.org>
> To: Dan Carpenter <error27@gmail.com>
> Cc: dmaengine@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
> drivers/dma/nbpfaxi.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c
> index 05d7321629cc..b1f06f0bd0d5 100644
> --- a/drivers/dma/nbpfaxi.c
> +++ b/drivers/dma/nbpfaxi.c
> @@ -1374,14 +1374,14 @@ static int nbpf_probe(struct platform_device *pdev)
> if (irqs == num_channels + 1) {
> struct nbpf_channel *chan;
>
> - for (i = 0, chan = nbpf->chan; i < num_channels;
> - i++, chan++) {
> + for (i = 0, chan = nbpf->chan; i < irqs; i++) {
> /* Skip the error IRQ */
> if (irqbuf[i] == eirq)
> - i++;
> - if (i >= ARRAY_SIZE(irqbuf))
> + continue;
> + if (chan >= nbpf->chan + num_channels)
Prefer my check, but sure...
It's pretty annoying that sashiko bot doesn't CC the CC list.
regards,
dan carpenter
> return -EINVAL;
> chan->irq = irqbuf[i];
> + chan++;
> }
> } else {
> /* 2 IRQs and more than one channel */
prev parent reply other threads:[~2026-07-09 10:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-03 7:56 [PATCH v3] dmaengine: nbpfaxi: Fix setting channel irqs in probe() Christian Taedcke via B4 Relay
2026-07-09 10:38 ` Dan Carpenter [this message]
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=ak96OkpYvJrK1Vbt@stanley.mountain \
--to=error27@gmail.com \
--cc=Frank.Li@kernel.org \
--cc=christian.taedcke-oss@weidmueller.com \
--cc=christian.taedcke@weidmueller.com \
--cc=dmaengine@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vkoul@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