summaryrefslogtreecommitdiffstats
path: root/drivers/remoteproc
diff options
context:
space:
mode:
authorSibi Sankar <sibis@codeaurora.org>2018-04-03 23:45:15 +0530
committerBjorn Andersson <bjorn.andersson@linaro.org>2018-04-05 22:53:16 -0700
commit730b2ad8f72898029160a6832141ba954122a0c8 (patch)
tree783d539515ec1c2b682fb18266d72b9fd4b14bed /drivers/remoteproc
parentdea4bd1975e36e3127a95e74c3670ea8d7f4796f (diff)
downloadlinux-730b2ad8f72898029160a6832141ba954122a0c8.tar.gz
linux-730b2ad8f72898029160a6832141ba954122a0c8.tar.bz2
linux-730b2ad8f72898029160a6832141ba954122a0c8.zip
remoteproc: fix null pointer dereference on glink only platforms
Currently calling list_del on smd subdev remove path results in null pointer dereference on glink only platforms. Fix this by adding safety checks in glink/smd subdev remove paths. Signed-off-by: Sibi Sankar <sibis@codeaurora.org> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Diffstat (limited to 'drivers/remoteproc')
-rw-r--r--drivers/remoteproc/qcom_common.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 9e47a147c131..acfc99f82fb8 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -75,6 +75,9 @@ EXPORT_SYMBOL_GPL(qcom_add_glink_subdev);
*/
void qcom_remove_glink_subdev(struct rproc *rproc, struct qcom_rproc_glink *glink)
{
+ if (!glink->node)
+ return;
+
rproc_remove_subdev(rproc, &glink->subdev);
of_node_put(glink->node);
}
@@ -165,6 +168,9 @@ EXPORT_SYMBOL_GPL(qcom_add_smd_subdev);
*/
void qcom_remove_smd_subdev(struct rproc *rproc, struct qcom_rproc_subdev *smd)
{
+ if (!smd->node)
+ return;
+
rproc_remove_subdev(rproc, &smd->subdev);
of_node_put(smd->node);
}