[PATCH 2/2] media: solo6x10: Fix potential invalid access after mapping failure
From: Tian Xuechen
Date: Sat Dec 05 2026 - 03:21:38 EST
pcim_iomap_region() returns an error pointer on failure. The probe unwind
checks reg_base for NULL and otherwise accesses device registers, so an
error pointer is incorrectly treated as a valid mapping.
Clear reg_base before entering the unwind path.
This issue was found by our static analysis tool under development.
Fixes: bd2ad1a08a4c ("media: solo6x10: Replace deprecated PCI functions")
Signed-off-by: Tian Xuechen <202300460064@xxxxxxxxxxxxxxx>
---
drivers/media/pci/solo6x10/solo6x10-core.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c
index 282c2c87151f..3d01c6f3fe05 100644
--- a/drivers/media/pci/solo6x10/solo6x10-core.c
+++ b/drivers/media/pci/solo6x10/solo6x10-core.c
@@ -479,8 +479,10 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
solo_dev->reg_base = pcim_iomap_region(pdev, 0, SOLO6X10_NAME);
ret = PTR_ERR_OR_ZERO(solo_dev->reg_base);
- if (ret)
+ if (ret) {
+ solo_dev->reg_base = NULL;
goto fail_probe;
+ }
chip_id = solo_reg_read(solo_dev, SOLO_CHIP_OPTION) &
SOLO_CHIP_ID_MASK;