2023-09-29 14:57:44

by Ekansh Gupta

[permalink] [raw]
Subject: [PATCH v1 0/3] Add fixes for FastRPC driver

This patchset carries the following fixes.
- Reset metadata buffer to avoid incorrect fd getting freed
- Free DMA handles for remote calls with no arguments
- Clean buffers on remote call failures

Ekansh Gupta (3):
misc: fastrpc: Reset metadata buffer to avoid incorrect free
misc: fastrpc: Free DMA handles for RPC calls with no arguments
misc: fastrpc: Clean buffers on remote invocation failures

drivers/misc/fastrpc.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)

--
2.7.4


2023-09-29 15:30:04

by Ekansh Gupta

[permalink] [raw]
Subject: [PATCH v1 1/3] 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.

Fixes: 8f6c1d8c4f0c ("misc: fastrpc: Add fdlist implementation")
Cc: stable <[email protected]>
Signed-off-by: Ekansh Gupta <[email protected]>
---
drivers/misc/fastrpc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index a66b7c1..fb92197 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -958,6 +958,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

2023-10-01 14:41:02

by Caleb Connolly

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Add fixes for FastRPC driver



On 29/09/2023 08:42, Ekansh Gupta wrote:
> This patchset carries the following fixes.
> - Reset metadata buffer to avoid incorrect fd getting freed
> - Free DMA handles for remote calls with no arguments
> - Clean buffers on remote call failures

Bit of a nit pick here, but you should try and use the cover letter to
explain the necessary context and justification for your series. An
overview of the commits is already included below by b4 or git-send-email.

It would be good to establish if these fixes are all related in some way
(ie to enable a specific usecase), or if it's just a few random things
that folks have discovered. Although it's almost always useful for
maintainers to know how these issues where discovered as it could expose
a gap in testing.

Regards,

>
> Ekansh Gupta (3):
> misc: fastrpc: Reset metadata buffer to avoid incorrect free
> misc: fastrpc: Free DMA handles for RPC calls with no arguments
> misc: fastrpc: Clean buffers on remote invocation failures
>
> drivers/misc/fastrpc.c | 26 ++++++++++++--------------
> 1 file changed, 12 insertions(+), 14 deletions(-)
>

--
// Caleb (they/them)

2023-10-09 06:04:57

by Srinivas Kandagatla

[permalink] [raw]
Subject: Re: [PATCH v1 0/3] Add fixes for FastRPC driver


On Fri, 29 Sep 2023 13:12:37 +0530, Ekansh Gupta wrote:
> This patchset carries the following fixes.
> - Reset metadata buffer to avoid incorrect fd getting freed
> - Free DMA handles for remote calls with no arguments
> - Clean buffers on remote call failures
>
> Ekansh Gupta (3):
> misc: fastrpc: Reset metadata buffer to avoid incorrect free
> misc: fastrpc: Free DMA handles for RPC calls with no arguments
> misc: fastrpc: Clean buffers on remote invocation failures
>
> [...]

Applied, thanks!

[1/3] misc: fastrpc: Reset metadata buffer to avoid incorrect free
commit: c44e396924d307ba11974b5f131e956b789a6844
[2/3] misc: fastrpc: Free DMA handles for RPC calls with no arguments
commit: 3f01aaeb9fd387108c04c4803b949b8cd84d43ff
[3/3] misc: fastrpc: Clean buffers on remote invocation failures
commit: 9fffb8240581927a71ed0ae46a5e269dbc0f3e3f

Best regards,
--
Srinivas Kandagatla <[email protected]>