remoteproc: imx_rproc: Skip over memory region when node value is NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Aleksandr Mishin <amishin@xxxxxxxxxx>

commit 2fa26ca8b786888673689ccc9da6094150939982 upstream.

In imx_rproc_addr_init() "nph = of_count_phandle_with_args()" just counts
number of phandles. But phandles may be empty. So of_parse_phandle() in
the parsing loop (0 < a < nph) may return NULL which is later dereferenced.
Adjust this issue by adding NULL-return check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver")
Signed-off-by: Aleksandr Mishin <amishin@xxxxxxxxxx>
Reviewed-by: Peng Fan <peng.fan@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Link: https://lore.kernel.org/r/20240606075204.12354-1-amishin@xxxxxxxxxx
[Fixed title to fit within the prescribed 70-75 charcters]
Signed-off-by: Mathieu Poirier <mathieu.poirier@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/remoteproc/imx_rproc.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/remoteproc/imx_rproc.c
+++ b/drivers/remoteproc/imx_rproc.c
@@ -726,6 +726,8 @@ static int imx_rproc_addr_init(struct im
 		struct resource res;
 
 		node = of_parse_phandle(np, "memory-region", a);
+		if (!node)
+			continue;
 		/* Not map vdevbuffer, vdevring region */
 		if (!strncmp(node->name, "vdev", strlen("vdev"))) {
 			of_node_put(node);


Patches currently in stable-queue which might be from amishin@xxxxxxxxxx are

queue-6.10/pci-keystone-fix-null-pointer-dereference-in-case-of.patch
queue-6.10/remoteproc-imx_rproc-fix-refcount-mistake-in-imx_rproc_addr_init.patch
queue-6.10/remoteproc-imx_rproc-skip-over-memory-region-when-node-value-is-null.patch
queue-6.10/asoc-amd-adjust-error-handling-in-case-of-absent-cod.patch
queue-6.10/wifi-rtw89-fix-array-index-mistake-in-rtw89_sta_info.patch
queue-6.10/asoc-qcom-adjust-issues-in-case-of-dt-error-in-asoc_.patch




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux