diff mbox

remoteproc: fix null pointer dereference on glink only platforms

Message ID 20180403181515.12322-1-sibis@codeaurora.org (mailing list archive)
State Accepted
Headers show

Commit Message

Sibi Sankar April 3, 2018, 6:15 p.m. UTC
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>
---
 drivers/remoteproc/qcom_common.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Bjorn Andersson April 6, 2018, 5:54 a.m. UTC | #1
On Tue 03 Apr 11:15 PDT 2018, Sibi Sankar wrote:

> 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>

Thanks Sibi.

Regards,
Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/remoteproc/qcom_common.c b/drivers/remoteproc/qcom_common.c
index 00602499713f..a0cd6a50913f 100644
--- a/drivers/remoteproc/qcom_common.c
+++ b/drivers/remoteproc/qcom_common.c
@@ -74,6 +74,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);
 }
@@ -121,6 +124,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);
 }