From: Eduard Zateev <hackerowskiy@gmail.com>
To: hackerowskiy@gmail.com
Cc: "Darrick J. Wong" <djwong@kernel.org>,
stable@vger.kernel.org, Christoph Hellwig <hch@lst.de>,
Carlos Maiolino <cem@kernel.org>
Subject: [PATCH 12/26] xfs: check di_forkoff correctly in scrub
Date: Tue, 22 Sep 2026 13:02:07 +0200 [thread overview]
Message-ID: <20260922110221.1431-12-hackerowskiy@gmail.com> (raw)
In-Reply-To: <20260922110221.1431-1-hackerowskiy@gmail.com>
From: "Darrick J. Wong" <djwong@kernel.org>
The di_forkoff check in xchk_dinode is incorrect, according to LOLLM.
XFS_DFORK_BOFF returns a byte count relative to the start of the literal
area, not the start of the inode. Therefore, this check won't flag
di_forkoff values that are larger than the literal area but not the
inode size itself. Fix this check; sadly the old APTR code was correct.
Cc: stable@vger.kernel.org # v6.8
Fixes: 6b5d917780219d ("xfs: dont cast to char * for XFS_DFORK_*PTR macros")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
---
fs/xfs/scrub/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c
index 65b13e311916..46e9bf4a4317 100644
--- a/fs/xfs/scrub/inode.c
+++ b/fs/xfs/scrub/inode.c
@@ -607,7 +607,7 @@ xchk_dinode(
}
/* di_forkoff */
- if (XFS_DFORK_BOFF(dip) >= mp->m_sb.sb_inodesize)
+ if (dip->di_forkoff >= (XFS_LITINO(mp) >> 3))
xchk_ino_set_corrupt(sc, ino);
if (naextents != 0 && dip->di_forkoff == 0)
xchk_ino_set_corrupt(sc, ino);
--
2.55.0
next prev parent reply other threads:[~2026-09-22 11:04 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260922110221.1431-1-hackerowskiy@gmail.com>
2026-09-22 11:01 ` [PATCH 02/26] xfs: don't assert when XFS_SCRUB_TYPE_HEALTHY scans return corruption Eduard Zateev
2026-09-22 11:01 ` [PATCH 03/26] xfs: fix attr fork block count checks in xrep_inode_blockcounts Eduard Zateev
2026-09-22 11:01 ` [PATCH 04/26] xfs: release orphanage dir inode if chown fails Eduard Zateev
2026-09-22 11:02 ` [PATCH 06/26] xfs: use correct jiffies comparison function in xchk_maybe_relax Eduard Zateev
2026-09-22 11:02 ` [PATCH 07/26] xfs: check padding field in xfs_ioc_commit_range Eduard Zateev
2026-09-22 11:02 ` [PATCH 08/26] xfs: don't call xfs_exchange_range_finish for a dry run Eduard Zateev
2026-09-22 11:02 ` [PATCH 09/26] xfs: use the correct reservations for rtrmap/refcount recovery Eduard Zateev
2026-09-22 11:02 ` [PATCH 11/26] xfs: only flag zero padding for dir3 data blocks, not dir3 block blocks Eduard Zateev
2026-09-22 11:02 ` Eduard Zateev [this message]
2026-09-22 11:02 ` [PATCH 17/26] xfs: call xfs_dquot_set_prealloc_limits if we installed default rtb limits Eduard Zateev
2026-09-22 11:02 ` [PATCH 18/26] xfs: fix rtgroup repair estimations Eduard Zateev
2026-09-22 11:02 ` [PATCH 19/26] xfs: don't cross reference rmapbt with bitmaps if they're incomplete Eduard Zateev
2026-09-22 11:02 ` [PATCH 20/26] xfs: don't let memory failures leak blocks and kill repairs Eduard Zateev
2026-09-22 11:02 ` [PATCH 21/26] xfs: don't merge different file IO error types Eduard Zateev
2026-09-22 11:02 ` [PATCH 22/26] xfs: fix blockgc group quota scanning when usrquota isn't enforced Eduard Zateev
2026-09-22 11:02 ` [PATCH 23/26] xfs: fix cursor and pointer handling when recovering iunlink buckets Eduard Zateev
2026-09-22 11:02 ` [PATCH 24/26] xfs: drop dquot flush lock when we can't find a buffer to flush Eduard Zateev
2026-09-22 11:02 ` [PATCH 25/26] xfs: don't let hidden_space go negative in xfs_metafile_resv_init Eduard Zateev
2026-09-22 11:02 ` [PATCH 26/26] xfs: fix wild memcpy access when formatting ondisk rtrefcount btree roots Eduard Zateev
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=20260922110221.1431-12-hackerowskiy@gmail.com \
--to=hackerowskiy@gmail.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@lst.de \
--cc=stable@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