From: Christoph Hellwig <hch@infradead.org>
To: Chelsy Ratnawat <chelsyratnawat2001@gmail.com>
Cc: cem@kernel.org, djwong@kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs : Fix potential null pointer dereference in xfs_exchmaps_dir_to_sf()
Date: Tue, 2 Dec 2025 22:21:08 -0800 [thread overview]
Message-ID: <aS_W1IHbi3-vlLOm@infradead.org> (raw)
In-Reply-To: <20251125142205.432890-1-chelsyratnawat2001@gmail.com>
On Tue, Nov 25, 2025 at 06:22:05AM -0800, Chelsy Ratnawat wrote:
> xfs_dir3_block_read() can return a NULL buffer with no error, but
> xfs_exchmaps_dir_to_sf() dereferences bp without checking it.
> Fix this by adding a check for NULL and returning -EFSCORRUPTED if bp is
> missing, since block-format directories must have a valid data block.
xfs_dir3_block_read is a thin wrapper around xfs_da_read_buf, which
like all the buffer functions should not return a NULL buffer unless
either an error occured, or the caller asked for read-ahead semantics,
which xfs_dir3_block_read never does. It seems like it currently
could when an invalid mapping is passed in (see the invalid_mapping
case in xfs_dabuf_map). I think we'd be much better off trying to
fix these inconsistencies than doctoring around them in the callers.
next prev parent reply other threads:[~2025-12-03 6:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-25 14:22 [PATCH] xfs : Fix potential null pointer dereference in xfs_exchmaps_dir_to_sf() Chelsy Ratnawat
2025-11-25 17:04 ` Darrick J. Wong
2025-12-03 6:21 ` Christoph Hellwig [this message]
2025-12-03 10:32 ` Carlos Maiolino
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=aS_W1IHbi3-vlLOm@infradead.org \
--to=hch@infradead.org \
--cc=cem@kernel.org \
--cc=chelsyratnawat2001@gmail.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.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