media: intel/ipu6: fix error pointer dereference
Subsystems (3)
PATCH v2 1/1 media: intel/ipu6: fix error pointer dereference
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()
---
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(-)
drivers/media/pci/intel/ipu6/ipu6.c +1 -1
@@ -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); }
Signature · 1 line
2.53.0
Quoted 3 lines · Ethan Tidmore
In a error path
isp->psysis 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 toout_ipu6_bus_del_devices.
Just noticed typo "beforegoing", will send v3 correcting this.
Thanks,
ET
Sakari Ailus
maintainerHi Ethan,
Quoted 6 lines · Ethan Tidmore
Quoted 3 lines · Ethan Tidmore
In a error path
isp->psysis 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 toout_ipu6_bus_del_devices.Just noticed typo "beforegoing", will send v3 correcting this.
No need to; I did that while applying the patch.
Thanks!
Signature · 3 lines
Regards, Sakari Ailus