Skip to content

Commit 2064843

Browse files
quic-ekanguptgregkh
authored andcommitted
misc: fastrpc: Free DMA handles for RPC calls with no arguments
The FDs for DMA handles to be freed is updated in fdlist by DSP over a remote call. This holds true even for remote calls with no arguments. To handle this, get_args and put_args are needed to be called for remote calls with no arguments also as fdlist is allocated in get_args and FDs updated in fdlist is freed in put_args. Fixes: 8f6c1d8 ("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-3-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1c29d80 commit 2064843

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

drivers/misc/fastrpc.c

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,7 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
10911091
}
10921092
}
10931093

1094+
/* Clean up fdlist which is updated by DSP */
10941095
for (i = 0; i < FASTRPC_MAX_FDLIST; i++) {
10951096
if (!fdlist[i])
10961097
break;
@@ -1157,11 +1158,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
11571158
if (IS_ERR(ctx))
11581159
return PTR_ERR(ctx);
11591160

1160-
if (ctx->nscalars) {
1161-
err = fastrpc_get_args(kernel, ctx);
1162-
if (err)
1163-
goto bail;
1164-
}
1161+
err = fastrpc_get_args(kernel, ctx);
1162+
if (err)
1163+
goto bail;
11651164

11661165
/* make sure that all CPU memory writes are seen by DSP */
11671166
dma_wmb();
@@ -1185,14 +1184,12 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
11851184
if (err)
11861185
goto bail;
11871186

1188-
if (ctx->nscalars) {
1189-
/* make sure that all memory writes by DSP are seen by CPU */
1190-
dma_rmb();
1191-
/* populate all the output buffers with results */
1192-
err = fastrpc_put_args(ctx, kernel);
1193-
if (err)
1194-
goto bail;
1195-
}
1187+
/* make sure that all memory writes by DSP are seen by CPU */
1188+
dma_rmb();
1189+
/* populate all the output buffers with results */
1190+
err = fastrpc_put_args(ctx, kernel);
1191+
if (err)
1192+
goto bail;
11961193

11971194
bail:
11981195
if (err != -ERESTARTSYS && err != -ETIMEDOUT) {

0 commit comments

Comments
 (0)