[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190823100622.3892-3-srinivas.kandagatla@linaro.org>
Date: Fri, 23 Aug 2019 11:06:19 +0100
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: gregkh@...uxfoundation.org
Cc: arnd@...db.de, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Mayank Chopra <mak.chopra@...eaurora.org>,
Abhinav Asati <asatiabhi@...eaurora.org>,
Vamsi Singamsetty <vamssi@...eaurora.org>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: [PATCH 2/5] misc: fastrpc: Don't reference rpmsg_device after remove
From: Bjorn Andersson <bjorn.andersson@...aro.org>
As fastrpc_rpmsg_remove() returns the rpdev of the channel context is no
longer a valid object, so ensure to update the channel context to no
longer reference the old object and guard in the invoke code path
against dereferencing it.
TEST=stop and start remote proc1 using sysfs
Signed-off-by: Bjorn Andersson <bjorn.andersson@...aro.org>
Signed-off-by: Mayank Chopra <mak.chopra@...eaurora.org>
Signed-off-by: Abhinav Asati <asatiabhi@...eaurora.org>
Signed-off-by: Vamsi Singamsetty <vamssi@...eaurora.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
---
drivers/misc/fastrpc.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index c019e867e7fa..59ee6de26229 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -913,6 +913,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
if (!fl->sctx)
return -EINVAL;
+ if (!fl->cctx->rpdev)
+ return -EPIPE;
+
ctx = fastrpc_context_alloc(fl, kernel, sc, args);
if (IS_ERR(ctx))
return PTR_ERR(ctx);
@@ -1495,6 +1498,7 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev)
misc_deregister(&cctx->miscdev);
of_platform_depopulate(&rpdev->dev);
+ cctx->rpdev = NULL;
fastrpc_channel_ctx_put(cctx);
}
--
2.21.0
Powered by blists - more mailing lists