From: "Anna Schumaker" <anna@kernel.org>
To: "Wentao Liang" <vulab@iscas.ac.cn>
Cc: linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org,
"Trond Myklebust" <trondmy@kernel.org>,
stable@vger.kernel.org
Subject: Re: [PATCH] NFS: Fix layout header use-after-free in pnfs_update_layout()
Date: Thu, 17 Sep 2026 13:49:13 -0400 [thread overview]
Message-ID: <b99eb918-37ae-4bea-8661-b74c8e9b11cc@app.fastmail.com> (raw)
In-Reply-To: <20260917162950.2162357-1-vulab@iscas.ac.cn>
Hi Wentao,
On Thu, Sep 17, 2026, at 12:29 PM, Wentao Liang wrote:
> When waiting for an in-progress layoutreturn to complete, the retry path
> drops the reference on the layout header with pnfs_put_layout_hdr() and
> only then passes the layout header to trace_pnfs_update_layout(). If
> that was the last reference, for example because the layout was torn
> down while the task slept in pnfs_prepare_to_retry_layoutget(), the
> tracepoint dereferences freed memory.
>
> Move the pnfs_put_layout_hdr() call after the tracepoint so the layout
> header is still valid while it is being traced.
>
> Fixes: 2c8d5fc37fe2 ("pNFS: Stricter ordering of layoutget and layoutreturn")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
This patch is already upstream as commit 13e198a90ca4 (included as part of
Linux 7.2).
Thanks,
Anna
> ---
> fs/nfs/pnfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
> index 743467e9ba20..aee523134c0f 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -2229,11 +2229,11 @@ pnfs_update_layout(struct inode *ino,
> dprintk("%s wait for layoutreturn\n", __func__);
> lseg = ERR_PTR(pnfs_prepare_to_retry_layoutget(lo));
> if (!IS_ERR(lseg)) {
> - pnfs_put_layout_hdr(lo);
> dprintk("%s retrying\n", __func__);
> trace_pnfs_update_layout(ino, pos, count, iomode, lo,
> lseg,
> PNFS_UPDATE_LAYOUT_RETRY);
> + pnfs_put_layout_hdr(lo);
> goto lookup_again;
> }
> trace_pnfs_update_layout(ino, pos, count, iomode, lo, lseg,
> --
> 2.34.1
prev parent reply other threads:[~2026-09-17 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 16:29 Wentao Liang
2026-09-17 17:49 ` Anna Schumaker [this message]
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=b99eb918-37ae-4bea-8661-b74c8e9b11cc@app.fastmail.com \
--to=anna@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=trondmy@kernel.org \
--cc=vulab@iscas.ac.cn \
/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®