remoteproc: imx_rproc: Skip over memory region when node value is NULL
ANBZ: #12926 commit2fa26ca8b7
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:a0ff4aa6f0
("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc driver") Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru> Reviewed-by: Peng Fan <peng.fan@nxp.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20240606075204.12354-1-amishin@t-argos.ru [Fixed title to fit within the prescribed 70-75 charcters] Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Fixes: CVE-2024-43860 Signed-off-by: Guanghui Feng <guanghuifeng@linux.alibaba.com> Reviewed-by: Guixin Liu <kanie@linux.alibaba.com> Link: https://gitee.com/anolis/cloud-kernel/pulls/4976
This commit is contained in:
parent
7df5dd5eac
commit
dfa30b1558
|
@ -287,6 +287,8 @@ static int imx_rproc_addr_init(struct imx_rproc *priv,
|
|||
struct resource res;
|
||||
|
||||
node = of_parse_phandle(np, "memory-region", a);
|
||||
if (!node)
|
||||
continue;
|
||||
err = of_address_to_resource(node, 0, &res);
|
||||
if (err) {
|
||||
dev_err(dev, "unable to resolve memory region\n");
|
||||
|
|
Loading…
Reference in New Issue