summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorEkansh Gupta <quic_ekangupt@quicinc.com>2023-10-13 15:20:04 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-02 11:35:31 +0300
commit1e8851b51300dc6ce33a6493b21d23927e059cc5 (patch)
treed18e6ed2e275ad5616d91874df46b4ffdf5637d9 /drivers/misc
parent5a35fc1c009188bde247898d0c8ea9feb50a4b02 (diff)
downloadlinux-1e8851b51300dc6ce33a6493b21d23927e059cc5.tar.xz
misc: fastrpc: Reset metadata buffer to avoid incorrect free
commit 1c29d80134ac116e0196c7bad58a2121381b679c upstream. Metadata buffer is allocated during get_args for any remote call. This buffer carries buffers, fdlists and other payload information for the call. If the buffer is not reset, put_args might find some garbage FDs in the fdlist which might have an existing mapping in the list. This could result in improper freeing of FD map when DSP might still be using the buffer. Added change to reset the metadata buffer after allocation. Fixes: 8f6c1d8c4f0c ("misc: fastrpc: Add fdlist implementation") Cc: stable <stable@kernel.org> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20231013122007.174464-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/fastrpc.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 4c51d216f3d4..93d5057f0977 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -903,6 +903,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
if (err)
return err;
+ memset(ctx->buf->virt, 0, pkt_size);
rpra = ctx->buf->virt;
list = fastrpc_invoke_buf_start(rpra, ctx->nscalars);
pages = fastrpc_phy_page_start(list, ctx->nscalars);