From: Jiale Yao <yaojiale02@163.com>
To: "Chas Williams" <3chas3@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
"françois romieu" <romieu@fr.zoreil.com>,
linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jiale Yao <yaojiale02@163.com>
Subject: [PATCH] atm: eni: stop IRQ tasklet during device removal
Date: Mon, 21 Sep 2026 01:33:58 +0800 [thread overview]
Message-ID: <20260920173358.2125807-1-yaojiale02@163.com> (raw)
eni_int() schedules eni_dev->task, but eni_remove_one() frees the
device state without unregistering the IRQ or draining the tasklet. An
interrupt during device unbind or hot unplug can therefore leave work
that runs after eni_dev has been freed.
Mask device interrupts, free the IRQ, and kill the tasklet before
releasing its resources. Apply the same ordering to the initialization
error path after the tasklet has been initialized.
Fixes: 126a3fd251b2 ("eni: fix driver remove function and driver probe error path.")
Signed-off-by: Jiale Yao <yaojiale02@163.com>
---
drivers/atm/eni.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c
index 3011cf1a84a9..44e6b3ceaf11 100644
--- a/drivers/atm/eni.c
+++ b/drivers/atm/eni.c
@@ -1881,7 +1881,11 @@ static int eni_start(struct atm_dev *dev)
return 0;
free_list:
+ eni_out(0, MID_IE);
+ free_irq(eni_dev->irq, dev);
+ tasklet_kill(&eni_dev->task);
kfree(eni_dev->free_list);
+ goto out;
free_irq:
free_irq(eni_dev->irq, dev);
@@ -2287,13 +2291,16 @@ MODULE_DEVICE_TABLE(pci,eni_pci_tbl);
static void eni_remove_one(struct pci_dev *pdev)
{
struct atm_dev *dev = pci_get_drvdata(pdev);
- struct eni_dev *ed = ENI_DEV(dev);
- struct eni_zero *zero = &ed->zero;
+ struct eni_dev *eni_dev = ENI_DEV(dev);
+ struct eni_zero *zero = &eni_dev->zero;
+ eni_out(0, MID_IE);
+ free_irq(eni_dev->irq, dev);
+ tasklet_kill(&eni_dev->task);
eni_do_release(dev);
atm_dev_deregister(dev);
dma_free_coherent(&pdev->dev, ENI_ZEROES_SIZE, zero->addr, zero->dma);
- kfree(ed);
+ kfree(eni_dev);
pci_disable_device(pdev);
}
--
2.34.1
reply other threads:[~2026-09-20 17:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260920173358.2125807-1-yaojiale02@163.com \
--to=yaojiale02@163.com \
--cc=3chas3@gmail.com \
--cc=davem@davemloft.net \
--cc=linux-atm-general@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=romieu@fr.zoreil.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox