[PATCH v2] media: intel/ipu6: fix error pointer dereference

From: Ethan Tidmore

Date: Fri Mar 06 2026 - 22:04:43 EST


In a error path isp->psys is confirmed to be an error pointer not NULL
so this condition is true and the error pointer is dereferenced. So
isp-psys should be set to NULL beforegoing to out_ipu6_bus_del_devices.

Detected by Smatch:
drivers/media/pci/intel/ipu6/ipu6.c:690 ipu6_pci_probe() error:
'isp->psys' dereferencing possible ERR_PTR()

Fixes: 25fedc021985a ("media: intel/ipu6: add Intel IPU6 PCI device driver")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Ethan Tidmore <ethantidmore06@xxxxxxxxx>
---
v2:
- Add stable tag.
- Add check for null instead of setting isp->psys to NULL.
- Add Smatch warning.

drivers/media/pci/intel/ipu6/ipu6.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c
index 34f67f4f1bb5..d033d4618169 100644
--- a/drivers/media/pci/intel/ipu6/ipu6.c
+++ b/drivers/media/pci/intel/ipu6/ipu6.c
@@ -686,7 +686,7 @@ static int ipu6_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
out_ipu6_rpm_put:
pm_runtime_put_sync(&isp->psys->auxdev.dev);
out_ipu6_bus_del_devices:
- if (isp->psys) {
+ if (!IS_ERR_OR_NULL(isp->psys)) {
ipu6_cpd_free_pkg_dir(isp->psys);
ipu6_buttress_unmap_fw_image(isp->psys, &isp->psys->fw_sgt);
}
--
2.53.0