mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ekansh Gupta <ekansh.gupta@oss.qualcomm.com>
To: Anandu Krishnan E <anandu.e@oss.qualcomm.com>,
	Srinivas Kandagatla <srini@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>
Cc: 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: Re: [PATCH v4 1/3] misc: fastrpc: remove dead context drain in fastrpc_user_free()
Date: Tue, 17 Nov 2026 21:05:15 +0530	[thread overview]
Message-ID: <443de2a5-d6ca-461e-b842-47b3acbf4031@oss.qualcomm.com> (raw)
In-Reply-To: <20261117-interrupted-invoke-v4-v4-1-2320a8a7eda2@oss.qualcomm.com>

On 17-11-2026 15:09, Anandu Krishnan E wrote:
> fastrpc_context_alloc() takes a reference on fl via fastrpc_user_get()
> for the lifetime of every context, and fastrpc_context_free() always
> unlinks the context from fl->pending before releasing that reference
does it? I don't see this in the driver code
> with fastrpc_user_put(). This means fl->refcount cannot reach zero -
> and fastrpc_user_free() cannot run - while any context is still linked
> on fl->pending: whichever context's release happens to be the one that
> drops the last reference has, by construction, already removed itself
> from the list a few lines earlier in the very same call.
> 
> The list_for_each_entry_safe() loop over fl->pending in
> fastrpc_user_free() can therefore never find anything to iterate. It
> has been unreachable since fl's own lifetime was switched from
> file-close-synchronous teardown to kref-counted teardown; it was never
> updated to reflect that the list it walks is now guaranteed empty by
> the time this callback can run. Remove it.
> 
> Fixes: e85eb5feca8e2 ("misc: fastrpc: fix use-after-free of fastrpc_user in workqueue context")
> Signed-off-by: Anandu Krishnan E <anandu.e@oss.qualcomm.com>
> ---
>  drivers/misc/fastrpc.c | 6 ------
>  1 file changed, 6 deletions(-)
> 
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 9e760f68bc..bb0c304196 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -568,17 +568,11 @@ static void fastrpc_context_put(struct fastrpc_invoke_ctx *ctx);
>  static void fastrpc_user_free(struct kref *ref)
>  {
>  	struct fastrpc_user *fl = container_of(ref, struct fastrpc_user, refcount);
> -	struct fastrpc_invoke_ctx *ctx, *n;
>  	struct fastrpc_map *map, *m;
>  	struct fastrpc_buf *buf, *b;
>  
>  	fastrpc_buf_free(fl->init_mem);
>  
> -	list_for_each_entry_safe(ctx, n, &fl->pending, node) {
> -		list_del(&ctx->node);
> -		fastrpc_context_put(ctx);
> -	}
> -
you should also remove the forward declaration of fastrpc_context_put().

>  	list_for_each_entry_safe(map, m, &fl->maps, node)
>  		fastrpc_map_put(map);
>  
> 


  reply	other threads:[~2026-11-17 15:35 UTC|newest]

Thread overview: 6+ 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 15:35   ` Ekansh Gupta [this message]
2026-11-17  9:39 ` [PATCH v4 2/3] misc: fastrpc: drop the DSP-response reference on channel removal Anandu Krishnan E
2026-11-17 15:49   ` Ekansh Gupta
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=443de2a5-d6ca-461e-b842-47b3acbf4031@oss.qualcomm.com \
    --to=ekansh.gupta@oss.qualcomm.com \
    --cc=anandu.e@oss.qualcomm.com \
    --cc=arnd@arndb.de \
    --cc=dri-devel@lists.freedesktop.org \
    --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®