From: Rosen Penev <rosenp@gmail.com>
To: linux-ide@vger.kernel.org
Cc: Damien Le Moal <dlemoal@kernel.org>,
Niklas Cassel <cassel@kernel.org>,
Jeff Garzik <jgarzik@redhat.com>,
Julia Lawall <Julia.Lawall@lip6.fr>,
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH 1/4] ata: pata_mpc52xx: switch to non-devm request_irq for proper ordering
Date: Mon, 8 Jun 2026 14:47:15 -0700 [thread overview]
Message-ID: <20260608214718.49503-2-rosenp@gmail.com> (raw)
In-Reply-To: <20260608214718.49503-1-rosenp@gmail.com>
The BestComm task IRQ handler accesses priv->dmatsk, which is freed
by bcom_ata_release(). With devm_request_irq(), the handler remains
registered until devres unwinds after the error/remove function
returns, creating a window where the handler can access freed memory.
Switch to request_irq() / free_irq() so that the interrupt is
unregistered before bcom_ata_release() tears down the task.
Assisted-by: opencode:big-pickle
Fixes: d01159dffa15 ("drivers/ata/pata_mpc52xx.c: clean up error handling code")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/ata/pata_mpc52xx.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/ata/pata_mpc52xx.c b/drivers/ata/pata_mpc52xx.c
index 210a63283f62..9af0aa89a5c6 100644
--- a/drivers/ata/pata_mpc52xx.c
+++ b/drivers/ata/pata_mpc52xx.c
@@ -767,11 +767,11 @@ static int mpc52xx_ata_probe(struct platform_device *op)
}
task_irq = bcom_get_task_irq(dmatsk);
- rv = devm_request_irq(&op->dev, task_irq, &mpc52xx_ata_task_irq, 0,
- "ATA task", priv);
+ rv = request_irq(task_irq, &mpc52xx_ata_task_irq, 0,
+ "ATA task", priv);
if (rv) {
dev_err(&op->dev, "error requesting DMA IRQ\n");
- goto err2;
+ goto err_free_task;
}
priv->dmatsk = dmatsk;
@@ -779,7 +779,7 @@ static int mpc52xx_ata_probe(struct platform_device *op)
rv = mpc52xx_ata_hw_init(priv);
if (rv) {
dev_err(&op->dev, "error initializing hardware\n");
- goto err2;
+ goto err_free_irq;
}
/* Register ourselves to libata */
@@ -787,13 +787,15 @@ static int mpc52xx_ata_probe(struct platform_device *op)
mwdma_mask, udma_mask);
if (rv) {
dev_err(&op->dev, "error registering with ATA layer\n");
- goto err2;
+ goto err_free_irq;
}
return 0;
- err2:
+ err_free_irq:
+ free_irq(task_irq, priv);
irq_dispose_mapping(task_irq);
+ err_free_task:
bcom_ata_release(dmatsk);
err1:
irq_dispose_mapping(ata_irq);
@@ -811,6 +813,7 @@ static void mpc52xx_ata_remove(struct platform_device *op)
/* Clean up DMA */
task_irq = bcom_get_task_irq(priv->dmatsk);
+ free_irq(task_irq, priv);
irq_dispose_mapping(task_irq);
bcom_ata_release(priv->dmatsk);
irq_dispose_mapping(priv->ata_irq);
--
2.54.0
next prev parent reply other threads:[~2026-06-08 21:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-08 21:47 [PATCH 0/4] ata: pata_mpc52xx: fix cleanup ordering and modernize Rosen Penev
2026-06-08 21:47 ` Rosen Penev [this message]
2026-06-08 21:59 ` [PATCH 1/4] ata: pata_mpc52xx: switch to non-devm request_irq for proper ordering sashiko-bot
2026-06-09 7:20 ` Niklas Cassel
2026-06-09 8:36 ` Andy Shevchenko
2026-06-08 21:47 ` [PATCH 2/4] ata: pata_mpc52xx: remove redundant irq_dispose_mapping calls Rosen Penev
2026-06-08 21:47 ` [PATCH 3/4] ata: pata_mpc52xx: convert to platform_get_irq() Rosen Penev
2026-06-08 21:47 ` [PATCH 4/4] ata: pata_mpc52xx: use devm_platform_get_and_ioremap_resource Rosen Penev
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=20260608214718.49503-2-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=Julia.Lawall@lip6.fr \
--cc=cassel@kernel.org \
--cc=dlemoal@kernel.org \
--cc=jgarzik@redhat.com \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.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