Re: [PATCH v4 2/3] misc: fastrpc: drop the DSP-response reference on channel removal

From: Ekansh Gupta

Date: Tue Nov 17 2026 - 10:49:57 EST


On 17-11-2026 15:09, Anandu Krishnan E wrote:
> fastrpc_invoke_send() takes a second reference on the invoke context
> before calling rpmsg_send(), to be dropped later by whichever side
> consumes the eventual DSP response: fastrpc_rpmsg_callback() for a
> real reply, via schedule_work(&ctx->put_work).
>
> fastrpc_notify_users(), called from fastrpc_rpmsg_remove() when the
> rpmsg channel goes away (e.g. on subsystem restart), only completes
> each pending context with -EPIPE so its waiter can return - it never
> schedules the matching put. Since the channel is gone, no response
> will ever arrive to trigger it through the normal callback path
> either. Every context that was genuinely in flight (successfully
> sent, not yet answered) at the time of an SSR therefore leaks that
> second reference, and with it the context, its DMA maps, and the
> reference it holds on fl and cctx.
>
> Schedule the same put_work that a real response would have
> triggered, exactly as fastrpc_rpmsg_callback() does. rpmsg guarantees
> .callback and .remove are mutually exclusive for a given device, so
> there is no concurrent real response that could race with this.
>
> Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
> Cc: stable@xxxxxxxxxx
> Signed-off-by: Anandu Krishnan E <anandu.e@xxxxxxxxxxxxxxxx>
> ---
> drivers/misc/fastrpc.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index bb0c304196..c5c3679f87 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -2835,6 +2835,13 @@ static void fastrpc_notify_users(struct fastrpc_user *user)
> list_for_each_entry(ctx, &user->pending, node) {
> ctx->retval = -EPIPE;
> complete(&ctx->work);
> + /*
> + * fastrpc_invoke_send() took a second reference for the
> + * DSP response that will now never arrive since the
> + * channel is gone; schedule the matching put the same
> + * way a real response would via fastrpc_rpmsg_callback().
> + */
> + schedule_work(&ctx->put_work);
Can you check the sashiko comment?

https://lore.kernel.org/all/sashiko-outbox-218551@xxxxxxxxxx/

> }
> spin_unlock(&user->lock);
> }
>