Skip to content

Commit 131c0a3

Browse files
gscuigregkh
authored andcommitted
remoteproc: sysmon: fix memory leak in qcom_add_sysmon_subdev()
[ Upstream commit e01ce67 ] The kfree() should be called when of_irq_get_byname() fails or devm_request_threaded_irq() fails in qcom_add_sysmon_subdev(), otherwise there will be a memory leak, so add kfree() to fix it. Fixes: 027045a ("remoteproc: qcom: Add shutdown-ack irq") Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com> Signed-off-by: Bjorn Andersson <andersson@kernel.org> Link: https://lore.kernel.org/r/20221129105650.1539187-1-cuigaosheng1@huawei.com Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 4507c6a commit 131c0a3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

drivers/remoteproc/qcom_sysmon.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,9 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
650650
if (sysmon->shutdown_irq != -ENODATA) {
651651
dev_err(sysmon->dev,
652652
"failed to retrieve shutdown-ack IRQ\n");
653-
return ERR_PTR(sysmon->shutdown_irq);
653+
ret = sysmon->shutdown_irq;
654+
kfree(sysmon);
655+
return ERR_PTR(ret);
654656
}
655657
} else {
656658
ret = devm_request_threaded_irq(sysmon->dev,
@@ -661,6 +663,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc *rproc,
661663
if (ret) {
662664
dev_err(sysmon->dev,
663665
"failed to acquire shutdown-ack IRQ\n");
666+
kfree(sysmon);
664667
return ERR_PTR(ret);
665668
}
666669
}

0 commit comments

Comments
 (0)