Commit 2e369878 authored by Bjorn Andersson's avatar Bjorn Andersson Committed by Greg Kroah-Hartman

misc: fastrpc: Don't reference rpmsg_device after remove

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.
Signed-off-by: default avatarBjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: default avatarMayank Chopra <mak.chopra@codeaurora.org>
Signed-off-by: default avatarAbhinav Asati <asatiabhi@codeaurora.org>
Signed-off-by: default avatarVamsi Singamsetty <vamssi@codeaurora.org>
Signed-off-by: default avatarSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20190829092926.12037-3-srinivas.kandagatla@linaro.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 278d56f9
...@@ -913,6 +913,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, ...@@ -913,6 +913,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
if (!fl->sctx) if (!fl->sctx)
return -EINVAL; return -EINVAL;
if (!fl->cctx->rpdev)
return -EPIPE;
ctx = fastrpc_context_alloc(fl, kernel, sc, args); ctx = fastrpc_context_alloc(fl, kernel, sc, args);
if (IS_ERR(ctx)) if (IS_ERR(ctx))
return PTR_ERR(ctx); return PTR_ERR(ctx);
...@@ -1495,6 +1498,7 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) ...@@ -1495,6 +1498,7 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev)
misc_deregister(&cctx->miscdev); misc_deregister(&cctx->miscdev);
of_platform_depopulate(&rpdev->dev); of_platform_depopulate(&rpdev->dev);
cctx->rpdev = NULL;
fastrpc_channel_ctx_put(cctx); fastrpc_channel_ctx_put(cctx);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment