From: sashiko-bot@kernel.org
To: "Rosen Penev" <rosenp@gmail.com>
Cc: cassel@kernel.org, dlemoal@kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 3/3] ata: pata_ep93xx: add COMPILE_TEST support
Date: Sat, 30 May 2026 04:57:01 +0000 [thread overview]
Message-ID: <20260530045701.6EEFE1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260530003627.42473-4-rosenp@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Double free of 'rx' DMA channel and invalid pointer dereference of `ERR_PTR` in the 'tx' DMA channel error path.
--
commit b636a1b70934f2b41b7dce1e54946eb6d1bed3b4
Author: Rosen Penev <rosenp@gmail.com>
ata: pata_ep93xx: add COMPILE_TEST support
This commit enables COMPILE_TEST support for the Cirrus Logic EP93xx PATA
controller. This allows the buildbots to compile the driver on other
architectures to find potential issues.
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index fff305ec1e788..28ca856ecc754 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -692,7 +692,7 @@ config PATA_EFAR
>
> config PATA_EP93XX
> tristate "Cirrus Logic EP93xx PATA support"
> - depends on ARCH_EP93XX
> + depends on ARCH_EP93XX || COMPILE_TEST
[Severity: High]
This isn't a bug introduced by this patch, but enabling COMPILE_TEST might
expose a pre-existing error handling issue in drivers/ata/pata_ep93xx.c.
In ep93xx_pata_dma_init(), if dma_request_chan() for "tx" fails, it stores
the ERR_PTR in drv_data->dma_tx_channel and jumps to fail_release_rx:
drivers/ata/pata_ep93xx.c:ep93xx_pata_dma_init() {
...
drv_data->dma_tx_channel = dma_request_chan(&pdev->dev, "tx");
if (IS_ERR(drv_data->dma_tx_channel)) {
ret = dev_err_probe(dev, PTR_ERR(drv_data->dma_tx_channel),
"tx DMA setup failed\n");
goto fail_release_rx;
}
...
fail_release_rx:
dma_release_channel(drv_data->dma_rx_channel);
fail_release_dma:
ep93xx_pata_release_dma(drv_data);
return ret;
}
Could this sequence lead to a double-free and an invalid pointer dereference?
The fail_release_rx path releases dma_rx_channel but doesn't clear the
pointer to NULL before falling through to ep93xx_pata_release_dma(). Also,
dma_tx_channel holds an ERR_PTR which is non-NULL.
When ep93xx_pata_release_dma() is called, it checks if the pointers are
non-NULL:
drivers/ata/pata_ep93xx.c:ep93xx_pata_release_dma() {
...
if (drv_data->dma_rx_channel) {
dma_release_channel(drv_data->dma_rx_channel);
drv_data->dma_rx_channel = NULL;
}
if (drv_data->dma_tx_channel) {
dma_release_channel(drv_data->dma_tx_channel);
drv_data->dma_tx_channel = NULL;
}
...
}
Would this result in dma_release_channel() being called a second time on
the rx channel, and being called with the ERR_PTR for the tx channel?
> select PATA_TIMINGS
> help
> This option enables support for the PATA controller in
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260530003627.42473-1-rosenp@gmail.com?part=3
prev parent reply other threads:[~2026-05-30 4:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-30 0:36 [PATCH 0/3] ata: pata_ep93xx: COMPILE_TEST and ARM fixups Rosen Penev
2026-05-30 0:36 ` [PATCH 1/3] ata: pata_ep93xx: avoid asm on non ARM Rosen Penev
2026-05-30 0:49 ` sashiko-bot
2026-05-30 0:36 ` [PATCH 2/3] ata: pata_ep93xx: use unsigned long for data Rosen Penev
2026-05-30 4:49 ` sashiko-bot
2026-05-30 0:36 ` [PATCH 3/3] ata: pata_ep93xx: add COMPILE_TEST support Rosen Penev
2026-05-30 4:57 ` 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=20260530045701.6EEFE1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=rosenp@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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