On Sun Sep 13 22:28:09 2026 -0400, Myeonghun Pak wrote:
> cx8802_init_common() enables the PCI device, then returns directly if
> DMA mask setup or IRQ registration fails. cx8802_probe() frees the
> device and drops the shared core reference without disabling PCI.
> 
> Disable the PCI device on both post-enable failures. Preserve -EIO for
> a DMA mask failure and the original request_irq() error. Do not call
> the full fini helper because the IRQ was not successfully requested.
> The successful probe and normal removal paths are unchanged.
> 
> These missing error-path disables are 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")
> Cc: [email protected]
> Co-developed-by: Ijae Kim <[email protected]>
> Signed-off-by: Ijae Kim <[email protected]>
> Signed-off-by: Myeonghun Pak <[email protected]>
> Assisted-by: OpenAI:GPT-5.6
> Signed-off-by: Hans Verkuil <[email protected]>

Patch committed.

Thanks,
Hans Verkuil

 drivers/media/pci/cx88/cx88-mpeg.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

---

diff --git a/drivers/media/pci/cx88/cx88-mpeg.c 
b/drivers/media/pci/cx88/cx88-mpeg.c
index 0c07ad335799..cd2366768f4a 100644
--- a/drivers/media/pci/cx88/cx88-mpeg.c
+++ b/drivers/media/pci/cx88/cx88-mpeg.c
@@ -392,7 +392,8 @@ static int cx8802_init_common(struct cx8802_dev *dev)
        err = dma_set_mask(&dev->pci->dev, DMA_BIT_MASK(32));
        if (err) {
                pr_err("Oops: no 32bit PCI DMA ???\n");
-               return -EIO;
+               err = -EIO;
+               goto fail_disable_device;
        }
 
        dev->pci_rev = dev->pci->revision;
@@ -413,13 +414,17 @@ static int cx8802_init_common(struct cx8802_dev *dev)
                          IRQF_SHARED, dev->core->name, dev);
        if (err < 0) {
                pr_err("can't get IRQ %d\n", dev->pci->irq);
-               return err;
+               goto fail_disable_device;
        }
        cx_set(MO_PCI_INTMSK, core->pci_irqmask);
 
        /* everything worked */
        pci_set_drvdata(dev->pci, dev);
        return 0;
+
+fail_disable_device:
+       pci_disable_device(dev->pci);
+       return err;
 }
 
 static void cx8802_fini_common(struct cx8802_dev *dev)
_______________________________________________
linuxtv-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to