[PATCH] parisc: fix NULL pointer dereference in ccio_cujo20_fixup()

From: zhangjiao2

Date: Fri Dec 04 2026 - 04:57:15 EST


From: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>

ccio_get_iommu() can return NULL if the parent IOA device is not found
or is not registered in the ioc_list. ccio_cujo20_fixup() dereferences
the returned ioc pointer without checking for NULL, leading to a kernel
crash on systems where the IOMMU lookup fails during the Cujo 2.0 bug
workaround.

Add a NULL check and return early if the IOMMU is not found.

Signed-off-by: zhang jiao <zhangjiao2@xxxxxxxxxxxxxxxxxxxx>
---
drivers/parisc/ccio-dma.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/parisc/ccio-dma.c b/drivers/parisc/ccio-dma.c
index a85efc41ce27..2a941258fb4c 100644
--- a/drivers/parisc/ccio-dma.c
+++ b/drivers/parisc/ccio-dma.c
@@ -1163,6 +1163,9 @@ void __init ccio_cujo20_fixup(struct parisc_device *cujo, u32 iovp)
struct ioc *ioc = ccio_get_iommu(dev);
u8 *res_ptr;

+ if (!ioc)
+ return;
+
ioc->cujo20_bug = 1;
res_ptr = ioc->res_map;
idx = PDIR_INDEX(iovp) >> 3;
--
2.33.0