Netdev List
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Ren Wei <n05ec@lzu.edu.cn>,
	linux-nfs@vger.kernel.org,  netdev@vger.kernel.org
Cc: trondmy@kernel.org, anna@kernel.org, chuck.lever@oracle.com,
	neil@brown.name, 	okorniev@redhat.com, Dai.Ngo@oracle.com,
	tom@talpey.com, yuantan098@gmail.com, 	yifanwucs@gmail.com,
	tomapufckgml@gmail.com, bird@lzu.edu.cn, rakukuip@gmail.com
Subject: Re: [PATCH 1/1] sunrpc: clear rq_procinfo in svc_release_rqst to prevent double-free
Date: Wed, 20 May 2026 06:46:47 -0400	[thread overview]
Message-ID: <2b28abdf244109c7ce13841df4cdd57a6fd94341.camel@kernel.org> (raw)
In-Reply-To: <8c4cfe3656a817a64da9cf62e42282a1f308b9dd.1779253342.git.rakukuip@gmail.com>

On Wed, 2026-05-20 at 16:13 +0800, Ren Wei wrote:
> From: Luxiao Xu <rakukuip@gmail.com>
> 
> The svc_release_rqst() function unconditionally calls
> rqstp->rq_procinfo->pc_release. However, svc_process_common()
> does not clear rq_procinfo when a worker thread starts processing
> a new request.
> 
> If a previous RPC selected a procedure with a non-idempotent
> release hook, and the subsequent RPC takes an early error path
> before a new rq_procinfo is installed (e.g., due to an oversized
> RPC fragment, bad auth, or unknown program), the stale release
> hook will run against reused state from the earlier RPC. This
> leads to a double-free or use-after-free vulnerability.
> 
> Fix this by setting rqstp->rq_procinfo to NULL immediately after
> executing the release hook in svc_release_rqst(), ensuring that
> stale procedure hooks cannot be re-triggered on early errors.
> 
> Fixes: d9adbb6e10bf ("sunrpc: delay pc_release callback until after the reply is sent")
> Cc: stable@kernel.org
> Reported-by: Yuan Tan <yuantan098@gmail.com>
> Reported-by: Yifan Wu <yifanwucs@gmail.com>
> Reported-by: Juefei Pu <tomapufckgml@gmail.com>
> Reported-by: Xin Liu <bird@lzu.edu.cn>
> Signed-off-by: Luxiao Xu <rakukuip@gmail.com>
> Signed-off-by: Ren Wei <n05ec@lzu.edu.cn>
> ---
>  net/sunrpc/svc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
> index d8ccb8e4b5c2..0332f05e7061 100644
> --- a/net/sunrpc/svc.c
> +++ b/net/sunrpc/svc.c
> @@ -1572,8 +1572,10 @@ static void svc_release_rqst(struct svc_rqst *rqstp)
>  {
>  	const struct svc_procedure *procp = rqstp->rq_procinfo;
>  
> -	if (procp && procp->pc_release)
> +	if (procp && procp->pc_release) {
>  		procp->pc_release(rqstp);
> +		rqstp->rq_procinfo = NULL;
> +	}
>  }
>  
>  /**

Reviewed-by: Jeff Layton <jlayton@kernel.org>

  reply	other threads:[~2026-05-20 10:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1779253342.git.rakukuip@gmail.com>
2026-05-20  8:13 ` [PATCH 1/1] sunrpc: clear rq_procinfo in svc_release_rqst to prevent double-free Ren Wei
2026-05-20 10:46   ` Jeff Layton [this message]
2026-05-20 14:36   ` Chuck Lever

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=2b28abdf244109c7ce13841df4cdd57a6fd94341.camel@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=bird@lzu.edu.cn \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=n05ec@lzu.edu.cn \
    --cc=neil@brown.name \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=rakukuip@gmail.com \
    --cc=tom@talpey.com \
    --cc=tomapufckgml@gmail.com \
    --cc=trondmy@kernel.org \
    --cc=yifanwucs@gmail.com \
    --cc=yuantan098@gmail.com \
    /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