Skip to contentSkip to conversation

AFFS fix for 7.1

GIT PULL New David Sterba 2 participants 3 messages Apr 10 – Apr 14

Subsystems (2)
lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

Hi,

please pull an AFFS fix. There's a potential out-of-bounds read in the directory hash table during readdir.

Thanks.

----------------------------------------------------------------
The following changes since commit c369299895a591d96745d6492d4888259b004a9e:

Linux 7.0-rc5 (2026-03-22 14:42:17 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git tags/affs-for-7.1-tag

for you to fetch changes up to 6fa253b38b9b293a0de2a361de400557ca7666ca:

affs: bound hash_pos before table lookup in affs_readdir (2026-04-10 02:51:05 +0200)

----------------------------------------------------------------
Hyungjung Joo (1):
affs: bound hash_pos before table lookup in affs_readdir

 fs/affs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
author maintainer
#1 lore raw

PATCH 1/1 affs: bound hash_pos before table lookup in affs_readdir

From: Hyungjung Joo <[email protected]>

affs_readdir() decodes ctx->pos into hash_pos and chain_pos and then dereferences AFFS_HEAD(dir_bh)->table[hash_pos] before validating that hash_pos is within the runtime table bound. Treat out-of-range positions as end-of-directory before the first table lookup.

---
 fs/affs/dir.c | 2 ++
 1 file changed, 2 insertions(+)
fs/affs/dir.c +2 -0
index 5c8d83387a39..075c18c4ccde 100644
@@ -119,6 +119,8 @@ affs_readdir(struct file *file, struct dir_context *ctx)
 		pr_debug("readdir() left off=%d\n", ino);
 		goto inside;
 	}
+	if (hash_pos >= AFFS_SB(sb)->s_hashsize)
+		goto done;
 
 	ino = be32_to_cpu(AFFS_HEAD(dir_bh)->table[hash_pos]);
 	for (i = 0; ino && i < chain_pos; i++) {
Signature · 1 line
2.51.0
merge bot Merged
#2 lore raw
In reply to David Sterba
The pull request you sent on Fri, 10 Apr 2026 03:38:25 +0200:

The pull request you sent on Fri, 10 Apr 2026 03:38:25 +0200:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git tags/affs-for-7.1-tag

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/f3756afb6f6cdcbbc246f1edd0580b8c7485124a

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html