public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: Christoph Hellwig <hch@infradead.org>
Cc: Long Li <leo.lilong@huawei.com>,
	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 07:37:19 -0700	[thread overview]
Message-ID: <20260320143719.GA6223@frogsfrogsfrogs> (raw)
In-Reply-To: <abz098auEFKW0D-m@infradead.org>

On Fri, Mar 20, 2026 at 12:19:19AM -0700, Christoph Hellwig wrote:
> "Don't allow UAF" reads rally giberrish.
> 
> 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.
> 
> Why does this matter?  The caller need to check the return value.

I think the fundamental problem here is that Long Li ran a static
checker, and the static checker suggested that the callsite in
xfs_attri_recover_work should be fixed by guarding the xfs_irele call in
the error handler with a null pointer check.  That's completely wrong,
the xfs_irele should never have been put in the error path at all.

So the proper fix is the one in the next patch that removes the
xfs_irele.  At the same time, xlog_recover_iget should get fixed so that
it never exposes stale pointers in the first place.

"Fix this function to avoid exposing a stale pointer to the caller when
returning an error code after dqattach fails." ?

> > The xfs_irele call in
> > xfs_attri_recover_work was never correct and should go away.
> 
> No idea what this is supposed to say, seem unrelated to this patch.

Yeah, I'll just drop that.

--D

  reply	other threads:[~2026-03-20 14:37 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 ` [PATCH 1/2] xfs: don't allow UAF in xlog_recover_iget Long Li
2026-03-20  7:19 ` Christoph Hellwig
2026-03-20 14:37   ` Darrick J. Wong [this message]
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=20260320143719.GA6223@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=cem@kernel.org \
    --cc=david@fromorbit.com \
    --cc=hch@infradead.org \
    --cc=houtao1@huawei.com \
    --cc=leo.lilong@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