[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1693463723-16937-1-git-send-email-quic_ekangupt@quicinc.com>
Date: Thu, 31 Aug 2023 12:05:23 +0530
From: Ekansh Gupta <quic_ekangupt@...cinc.com>
To: <srinivas.kandagatla@...aro.org>, <linux-arm-msm@...r.kernel.org>
CC: Ekansh Gupta <quic_ekangupt@...cinc.com>,
<ekangupt@....qualcomm.com>, <gregkh@...uxfoundation.org>,
<linux-kernel@...r.kernel.org>, <fastrpc.upstream@....qualcomm.com>
Subject: [PATCH v1] misc: fastrpc: Reset metadata buffer to avoid incorrect free
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.
Signed-off-by: Ekansh Gupta <quic_ekangupt@...cinc.com>
---
drivers/misc/fastrpc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 9666d28..8acdeb5 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -955,6 +955,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);
--
2.7.4
Powered by blists - more mailing lists