Skip to contentSkip to conversation

net/qla3xxx: disable the PCI device on remove

PATCH Applied Myeonghun Pak 3 participants 3 messages Sep 13 – Sep 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net/qla3xxx: disable the PCI device on remove

ql3xxx_probe() enables the PCI device and balances that reference on probe failure. However, ql3xxx_remove() releases the mappings and PCI regions without disabling the device, leaving the enable reference held after unbind.

Add pci_disable_device() at the end of ql3xxx_remove() to balance the successful probe's pci_enable_device() call. Keep the existing manual cleanup and probe error handling unchanged.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 5a4faa873782 ("[PATCH] qla3xxx NIC driver")

---
v2:
- Add pci_disable_device() to ql3xxx_remove() instead of converting to pcim_enable_device(), as suggested by Simon Horman.
v1: https://lore.kernel.org/netdev/[email protected]/

 drivers/net/ethernet/qlogic/qla3xxx.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/qlogic/qla3xxx.c +1 -0
@@ -3916,6 +3916,7 @@ static void ql3xxx_remove(struct pci_dev *pdev)
 	iounmap(qdev->mem_map_registers);
 	pci_release_regions(pdev);
 	free_netdev(ndev);
+	pci_disable_device(pdev);
 }
 
 static struct pci_driver ql3xxx_driver = {
Signature · 1 line
2.53.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 16 lines · Myeonghun Pak

ql3xxx_probe() enables the PCI device and balances that reference on probe failure. However, ql3xxx_remove() releases the mappings and PCI regions without disabling the device, leaving the enable reference held after unbind.

Add pci_disable_device() at the end of ql3xxx_remove() to balance the successful probe's pci_enable_device() call. Keep the existing manual cleanup and probe error handling unchanged.

This issue was identified during our ongoing static-analysis research while reviewing kernel code.

Fixes 5a4faa873782 ("[PATCH] qla3xxx NIC driver")
Quoted 5 lines

---
v2:
- Add pci_disable_device() to ql3xxx_remove() instead of converting to pcim_enable_device(), as suggested by Simon Horman.
v1: https://lore.kernel.org/netdev/[email protected]/

Thanks for the update.

#2 lore raw
In reply to Myeonghun Pak
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 10 lines · On Sun, 13 Sep 2026 16:45:34 -0400 you wrote:

ql3xxx_probe() enables the PCI device and balances that reference on probe failure. However, ql3xxx_remove() releases the mappings and PCI regions without disabling the device, leaving the enable reference held after unbind.

Add pci_disable_device() at the end of ql3xxx_remove() to balance the successful probe's pci_enable_device() call. Keep the existing manual cleanup and probe error handling unchanged.

[...]

Here is the summary with links:
- [net,v2] net/qla3xxx: disable the PCI device on remove

    https://git.kernel.org/netdev/net-next/c/d328b5ad4a52

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html