Skip to content

Commit

Permalink
misc: fastrpc: Clean buffers on remote invocation failures
Browse files Browse the repository at this point in the history
commit 1c80935 upstream.

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>
  • Loading branch information
quic-ekangupt authored and gregkh committed Nov 2, 2023
1 parent c2400bf commit 8e4afa8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/misc/fastrpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,11 +1175,6 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
err = wait_for_completion_interruptible(&ctx->work);
}

if (err)
goto bail;

/* Check the response from remote dsp */
err = ctx->retval;
if (err)
goto bail;

Expand All @@ -1190,6 +1185,11 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
if (err)
goto bail;

/* Check the response from remote dsp */
err = ctx->retval;
if (err)
goto bail;

bail:
if (err != -ERESTARTSYS && err != -ETIMEDOUT) {
/* We are done with this compute context */
Expand Down

0 comments on commit 8e4afa8

Please sign in to comment.