public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] AFFS fix for 7.1
@ 2026-04-10  1:38 David Sterba
  2026-04-10  1:38 ` [PATCH 1/1] affs: bound hash_pos before table lookup in affs_readdir David Sterba
  0 siblings, 1 reply; 2+ messages in thread
From: David Sterba @ 2026-04-10  1:38 UTC (permalink / raw)
  To: torvalds; +Cc: David Sterba, linux-fsdevel, linux-kernel

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(+)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] affs: bound hash_pos before table lookup in affs_readdir
  2026-04-10  1:38 [GIT PULL] AFFS fix for 7.1 David Sterba
@ 2026-04-10  1:38 ` David Sterba
  0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2026-04-10  1:38 UTC (permalink / raw)
  To: torvalds; +Cc: Hyungjung Joo, linux-fsdevel, linux-kernel, David Sterba

From: Hyungjung Joo <jhj140711@gmail.com>

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.

Signed-off-by: Hyungjung Joo <jhj140711@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---
 fs/affs/dir.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/affs/dir.c b/fs/affs/dir.c
index 5c8d83387a39..075c18c4ccde 100644
--- a/fs/affs/dir.c
+++ b/fs/affs/dir.c
@@ -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++) {
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-04-10  1:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10  1:38 [GIT PULL] AFFS fix for 7.1 David Sterba
2026-04-10  1:38 ` [PATCH 1/1] affs: bound hash_pos before table lookup in affs_readdir David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox