From: "Жамбакиев Радий Рикардинович" <r.zhambakiev@prosoftsystems.ru>
To: Andrew Lunn <andrew+netdev@lunn.ch>
Cc: "Жамбакиев Радий Рикардинович" <r.zhambakiev@prosoftsystems.ru>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Michael Grzeschik" <mgr@kernel.org>,
"Jijie Shao" <shaojijie@huawei.com>,
"Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
"Denis Benato" <benato.denis96@gmail.com>,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lvc-project@linuxtesting.org" <lvc-project@linuxtesting.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: [PATCH net v2 2/3] net: fealnx: disable the PCI device on remove and probe failure
Date: Fri, 2 Oct 2026 14:10:09 +0000 [thread overview]
Message-ID: <20261002140954.261779-3-r.zhambakiev@prosoftsystems.ru> (raw)
In-Reply-To: <20261002140954.261779-1-r.zhambakiev@prosoftsystems.ru>
From: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
pci_enable_device() is called in probe, but the device is never
disabled on probe failure or remove. Device remains enabled and
bus mastering stays active.
Add pci_disable_device() to the probe error unwind and to
fealnx_remove_one(), after all other resources have been released.
Found by Linux Verification Center (linuxtesting.org)
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Radiy Zhambakiev <r.zhambakiev@prosoftsystems.ru>
---
drivers/net/ethernet/fealnx.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/fealnx.c b/drivers/net/ethernet/fealnx.c
index 68194c9ef332..b5e96c7037f3 100644
--- a/drivers/net/ethernet/fealnx.c
+++ b/drivers/net/ethernet/fealnx.c
@@ -502,12 +502,13 @@ static int fealnx_init_one(struct pci_dev *pdev,
if (len < MIN_REGION_SIZE) {
dev_err(&pdev->dev,
"region size %ld too small, aborting\n", len);
- return -ENODEV;
+ err = -ENODEV;
+ goto err_out_disable;
}
- i = pci_request_regions(pdev, boardname);
- if (i)
- return i;
+ err = pci_request_regions(pdev, boardname);
+ if (err)
+ goto err_out_disable;
irq = pdev->irq;
@@ -671,6 +672,8 @@ static int fealnx_init_one(struct pci_dev *pdev,
pci_iounmap(pdev, ioaddr);
err_out_res:
pci_release_regions(pdev);
+err_out_disable:
+ pci_disable_device(pdev);
return err;
}
@@ -690,6 +693,7 @@ static void fealnx_remove_one(struct pci_dev *pdev)
pci_iounmap(pdev, np->mem);
free_netdev(dev);
pci_release_regions(pdev);
+ pci_disable_device(pdev);
} else
printk(KERN_ERR "fealnx: remove for unknown device\n");
}
--
2.53.0
next prev parent reply other threads:[~2026-10-02 14:10 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-02 14:10 [PATCH net v2 0/3] net: fealnx: fix card-index overflow and PCI device teardown Жамбакиев Радий Рикардинович
2026-10-02 14:10 ` [PATCH net v2 1/3] net: fealnx: fix teardown order in remove Жамбакиев Радий Рикардинович
2026-10-02 14:18 ` Loktionov, Aleksandr
2026-10-02 14:18 ` Loktionov, Aleksandr
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-02 14:10 ` Жамбакиев Радий Рикардинович [this message]
2026-10-02 14:10 ` [PATCH net v2 3/3] net: fealnx: allocate the card index from an IDA Жамбакиев Радий Рикардинович
2026-10-02 20:28 ` Andrew Lunn
2026-10-06 14:31 ` netdev-bot+sashiko
2026-10-02 14:13 ` [PATCH net v2 0/3] net: fealnx: fix card-index overflow and PCI device teardown netdev-bot+sinfo
2026-10-02 14:20 ` Жамбакиев Радий Рикардинович
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=20261002140954.261779-3-r.zhambakiev@prosoftsystems.ru \
--to=r.zhambakiev@prosoftsystems.ru \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=benato.denis96@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lvc-project@linuxtesting.org \
--cc=mgr@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shaojijie@huawei.com \
--cc=stable@vger.kernel.org \
--cc=u.kleine-koenig@baylibre.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