Skip to content

Commit

Permalink
remoteproc: qcom: q6v5: Fix potential null-ptr-deref in q6v5_wcss_ini…
Browse files Browse the repository at this point in the history
…t_mmio()

[ Upstream commit f360e2b ]

q6v5_wcss_init_mmio() will call platform_get_resource_byname() that may
fail and return NULL. devm_ioremap() will use res->start as input, which
may causes null-ptr-deref. Check the ret value of
platform_get_resource_byname() to avoid the null-ptr-deref.

Fixes: 0af65b9 ("remoteproc: qcom: wcss: Add non pas wcss Q6 support for QCS404")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20221125021641.29392-1-shangxiaojing@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Shang XiaoJing authored and gregkh committed Dec 31, 2022
1 parent 131c0a3 commit 098ebb9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/remoteproc/qcom_q6v5_wcss.c
Expand Up @@ -827,6 +827,9 @@ static int q6v5_wcss_init_mmio(struct q6v5_wcss *wcss,
int ret;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qdsp6");
if (!res)
return -EINVAL;

wcss->reg_base = devm_ioremap(&pdev->dev, res->start,
resource_size(res));
if (!wcss->reg_base)
Expand Down

0 comments on commit 098ebb9

Please sign in to comment.