From: Long Li <leo.lilong@huawei.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: <cem@kernel.org>, <linux-xfs@vger.kernel.org>,
<david@fromorbit.com>, <yi.zhang@huawei.com>,
<houtao1@huawei.com>, <yangerkun@huawei.com>,
<lonuxli.64@gmail.com>
Subject: Re: [PATCH 1/2] xfs: don't allow UAF in xlog_recover_iget
Date: Fri, 20 Mar 2026 10:02:08 +0800 [thread overview]
Message-ID: <abyqoPTmtBVFfOuJ@localhost.localdomain> (raw)
In-Reply-To: <20260319170938.GS1770774@frogsfrogsfrogs>
On Thu, Mar 19, 2026 at 10:09:38AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Fix this function to avoid touching the passed in ipp argument until
> we're 100% certain that we're returning zero. This avoids creating a
> dangling pointer in the caller. The xfs_irele call in
> xfs_attri_recover_work was never correct and should go away.
>
> Cc: <stable@vger.kernel.org> # v5.15
> Fixes: 4bc619833f738f ("xfs: refactor xfs_iget calls from log intent recovery")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_log_recover.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index 09e6678ca4878e..0e91a62348eb79 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -1745,21 +1745,23 @@ xlog_recover_iget(
> xfs_ino_t ino,
> struct xfs_inode **ipp)
> {
> + struct xfs_inode *ip;
> int error;
>
> - error = xfs_iget(mp, NULL, ino, 0, 0, ipp);
> + error = xfs_iget(mp, NULL, ino, 0, 0, &ip);
> if (error)
> return error;
>
> - error = xfs_qm_dqattach(*ipp);
> + error = xfs_qm_dqattach(ip);
> if (error) {
> - xfs_irele(*ipp);
> + xfs_irele(ip);
> return error;
> }
>
> - if (VFS_I(*ipp)->i_nlink == 0)
> - xfs_iflags_set(*ipp, XFS_IRECOVERY);
> + if (VFS_I(ip)->i_nlink == 0)
> + xfs_iflags_set(ip, XFS_IRECOVERY);
>
> + *ipp = ip;
> return 0;
> }
>
>
Looks good
Reviewed-by: Long Li <leo.lilong@huawei.com>
next prev parent reply other threads:[~2026-03-20 2:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-19 17:09 [PATCH 1/2] xfs: don't allow UAF in xlog_recover_iget Darrick J. Wong
2026-03-19 17:10 ` [PATCH 2/2] xfs: don't irele after failing to iget in xfs_attri_recover_work Darrick J. Wong
2026-03-20 2:02 ` Long Li
2026-03-20 7:19 ` Christoph Hellwig
2026-03-20 2:02 ` Long Li [this message]
2026-03-20 7:19 ` [PATCH 1/2] xfs: don't allow UAF in xlog_recover_iget Christoph Hellwig
2026-03-20 14:37 ` Darrick J. Wong
2026-03-23 6:07 ` Christoph Hellwig
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=abyqoPTmtBVFfOuJ@localhost.localdomain \
--to=leo.lilong@huawei.com \
--cc=cem@kernel.org \
--cc=david@fromorbit.com \
--cc=djwong@kernel.org \
--cc=houtao1@huawei.com \
--cc=linux-xfs@vger.kernel.org \
--cc=lonuxli.64@gmail.com \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.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