serial: icom: Disable the PCI device on final adapter release
Subsystems (2)
PATCH 1/1 serial: icom: Disable the PCI device on final adapter release
icom_probe() enables the PCI device, but the final adapter release never disables it. Balance the enable after releasing the IRQ, mapping and PCI regions, while the adapter's PCI device pointer is still valid.
The imbalance is already present in the initial Git import.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
--- drivers/tty/serial/icom.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/icom.c +1 -0
@@ -1691,6 +1691,7 @@ static void icom_kref_release(struct kref *kref)free_irq (icom_adapter->pci_dev->irq, (void *) icom_adapter);iounmap (icom_adapter->base_addr);pci_release_regions (icom_adapter->pci_dev); +pci_disable_device (icom_adapter->pci_dev);icom_free_adapter (icom_adapter); }
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 9 lines
icom_probe()enables the PCI device, but the final adapter release never disables it. Balance the enable after releasing the IRQ, mapping and PCI regions, while the adapter's PCI device pointer is still valid.The imbalance is already present in the initial Git import.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Quoted 6 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Assisted-by LLMCo-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Greg Kroah-Hartman
maintainerQuoted 23 lines · Myeonghun Pak
icom_probe()enables the PCI device, but the final adapter release never disables it. Balance the enable after releasing the IRQ, mapping and PCI regions, while the adapter's PCI device pointer is still valid.The imbalance is already present in the initial Git import.
This issue was identified during our ongoing static-analysis research while reviewing kernel code.
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")Assisted-by LLMCo-developed-by Ijae Kim <[email protected]>Signed-off-by Ijae Kim <[email protected]>Signed-off-by Myeonghun Pak <[email protected]>--- drivers/tty/serial/icom.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/icom.c static void icom_kref_release(struct kref *kref) · line 1694
Quoted 4 lines
drivers/tty/serial/icom.c +1
-0@@ -1691,6 +1691,7 @@ static void icom_kref_release(struct kref *kref)free_irq (icom_adapter->pci_dev->irq, (void *) icom_adapter);iounmap (icom_adapter->base_addr);pci_release_regions (icom_adapter->pci_dev); +pci_disable_device (icom_adapter->pci_dev);
Are you sure this is correct? Lots of time disabling the device is not what you want to do as it can cause hardware problems.
Have you tested this on the hardware? If not, I can't take it for obvious reasons.
thanks,
greg k-h