Skip to content

Commit 1c80935

Browse files
quic-ekanguptgregkh
authored andcommitted
misc: fastrpc: Clean buffers on remote invocation failures
With current design, buffers and dma handles are not freed in case of remote invocation failures returned from DSP. This could result in buffer leakings and dma handle pointing to wrong memory in the fastrpc kernel. Adding changes to clean buffers and dma handles even when remote invocation to DSP returns failures. Fixes: c68cfb7 ("misc: fastrpc: Add support for context Invoke method") 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-4-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 2064843 commit 1c80935

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/misc/fastrpc.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,11 +1176,6 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
11761176
err = wait_for_completion_interruptible(&ctx->work);
11771177
}
11781178

1179-
if (err)
1180-
goto bail;
1181-
1182-
/* Check the response from remote dsp */
1183-
err = ctx->retval;
11841179
if (err)
11851180
goto bail;
11861181

@@ -1191,6 +1186,11 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
11911186
if (err)
11921187
goto bail;
11931188

1189+
/* Check the response from remote dsp */
1190+
err = ctx->retval;
1191+
if (err)
1192+
goto bail;
1193+
11941194
bail:
11951195
if (err != -ERESTARTSYS && err != -ETIMEDOUT) {
11961196
/* We are done with this compute context */

0 commit comments

Comments
 (0)