From: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
To: Srinivas Kandagatla <srini@kernel.org>,
Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Cc: Anandu Krishnan E <anandu.e@oss.qualcomm.com>,
linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, stable@kernel.org,
Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>,
quic_bkumar@quicinc.com, quic_chennak@quicinc.com
Subject: [PATCH v4 2/3] misc: fastrpc: drop the DSP-response reference on channel removal
Date: Tue, 17 Nov 2026 15:09:46 +0530 [thread overview]
Message-ID: <20261117-interrupted-invoke-v4-v4-2-2320a8a7eda2@oss.qualcomm.com> (raw)
In-Reply-To: <20261117-interrupted-invoke-v4-v4-0-2320a8a7eda2@oss.qualcomm.com>
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@kernel.org
Signed-off-by: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
---
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);
}
spin_unlock(&user->lock);
}
--
2.34.1
next prev parent reply other threads:[~2026-11-17 9:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 9:39 [PATCH v4 0/3] misc: fastrpc: fix context leak and hang on signal-interrupted invoke Anandu Krishnan E
2026-11-17 9:39 ` [PATCH v4 1/3] misc: fastrpc: remove dead context drain in fastrpc_user_free() Anandu Krishnan E
2026-11-17 9:39 ` Anandu Krishnan E [this message]
2026-11-17 9:39 ` [PATCH v4 3/3] misc: fastrpc: fix context leak and hang on signal-interrupted invoke Anandu Krishnan E
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261117-interrupted-invoke-v4-v4-2-2320a8a7eda2@oss.qualcomm.com \
--to=anandu.e@oss.qualcomm.com \
--cc=arnd@arndb.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=ekansh.gupta@oss.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jorge.ramirez@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_bkumar@quicinc.com \
--cc=quic_chennak@quicinc.com \
--cc=srini@kernel.org \
--cc=srinivas.kandagatla@oss.qualcomm.com \
--cc=stable@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®