Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: imx@lists.linux.dev, dmaengine@vger.kernel.org, vkoul@kernel.org,
	Frank.Li@kernel.org
Subject: Re: [PATCH 3/3] dmaengine: fsl-edma: use dmaengine_get_dma_device()
Date: Mon, 23 Nov 2026 01:34:42 +0000	[thread overview]
Message-ID: <sashiko-outbox-228520@kernel.org> (raw)
In-Reply-To: <20261123-edma-fixes-v1-3-59d5da374a16@nxp.com>

Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [High] dmaengine: fsl-edma: unchecked dma_pool_create() in
  fsl_edma_alloc_chan_resources() [1]
--

commit d7d84b7032569e7e063763bff448d75503da9441
Author: Peng Fan <peng.fan@nxp.com>

dmaengine: fsl-edma: use dmaengine_get_dma_device()

This commit uses dmaengine_get_dma_device() instead of chan->device->dev
when creating the TCD pool and mapping slave DMA resources.

> diff --git a/drivers/dma/fsl-edma-common.c b/drivers/dma/fsl-edma-common.c
> index 513b0f4e5be21..62cd60179bc6f 100644
> --- a/drivers/dma/fsl-edma-common.c
> +++ b/drivers/dma/fsl-edma-common.c

[ ... ]

> @@ -1090,7 +1090,7 @@ int fsl_edma_alloc_chan_resources(struct dma_chan *chan)
>  	if (fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_HAS_CHCLK)
>  		clk_prepare_enable(fsl_chan->clk);
>  
> -	fsl_chan->tcd_pool = dma_pool_create("tcd_pool", chan->device->dev,
> +	fsl_chan->tcd_pool = dma_pool_create("tcd_pool", dmaengine_get_dma_device(chan),
>  				fsl_edma_drvflags(fsl_chan) & FSL_EDMA_DRV_TCD64 ?
>  				sizeof(struct fsl_edma_hw_tcd64) : sizeof(struct fsl_edma_hw_tcd),
>  				32, 0);

[Severity: High]
This problem wasn't introduced by this patch, but can a failure in
dma_pool_create() lead to a NULL pointer dereference [1]?

fsl_edma_alloc_chan_resources() does not check fsl_chan->tcd_pool for NULL
and still returns 0.  A subsequent transfer preparation then passes the
NULL fsl_chan->tcd_pool to dma_pool_alloc() in fsl_edma_alloc_desc().

[1] https://sashiko.dev/#/bug/linux-39a3675f-2d52-4af1-8fbc-609bc1c22d2a

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-edma-fixes-v1-0-59d5da374a16@nxp.com?part=3

      reply	other threads:[~2026-11-23  1:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  1:32 [PATCH 0/3] dmaengine: edma: fix vchan cleanup and improvement Peng Fan (OSS)
2026-11-23  1:32 ` [PATCH 1/3] dmaengine: fsl-edma: unregister channels before vchan cleanup Peng Fan (OSS)
2026-11-23  1:32 ` [PATCH 2/3] dmaengine: fsl-edma: use BIT_ULL for 64-bit channel mask Peng Fan (OSS)
2026-11-23  1:34   ` sashiko-bot
2026-11-23  1:32 ` [PATCH 3/3] dmaengine: fsl-edma: use dmaengine_get_dma_device() Peng Fan (OSS)
2026-11-23  1:34   ` sashiko-bot [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=sashiko-outbox-228520@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=peng.fan@oss.nxp.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --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