All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Zeng <kylebot@openai.com>
To: stable@vger.kernel.org
Cc: outbounddisclosures@openai.com, Kyle Zeng <kylebot@openai.com>
Subject: [PATCH] reiserfs: continue checking leaf items after directories
Date: Thu, 11 Jun 2026 15:40:59 -0700	[thread overview]
Message-ID: <20260611224059.76010-1-kylebot@openai.com> (raw)

is_leaf() validates each item header in a leaf before the leaf is
trusted by search_by_key().  The directory-item case currently returns
the result of has_valid_deh_location() directly from inside that loop.
If the first directory item is valid, the whole leaf is accepted and any
later item headers are never checked.

A crafted leaf can put a valid directory item before a malformed later
stat-data, direct, indirect, or directory item.  search_by_key() can then
select the unchecked item and consumers use ih_item_body() on attacker
controlled ih_location/ih_item_len values.

Keep the directory-entry validation, but only fail the leaf when that
validation fails.  If it succeeds, continue the item-header loop so the
remaining headers are checked.

Fixes: 13d257503c09 ("reiserfs: check directory items on read from disk")
Cc: stable@vger.kernel.org
Assisted-by: Codex:gpt-5.5
Signed-off-by: Kyle Zeng <kylebot@openai.com>
---
 fs/reiserfs/stree.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 5faf702f8d15..0f4eb9627a39 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -479,7 +479,8 @@ static int is_leaf(char *buf, int blocksize, struct buffer_head *bh)
 						 ih);
 				return 0;
 			}
-			return has_valid_deh_location(bh, ih);
+			if (!has_valid_deh_location(bh, ih))
+				return 0;
 		}
 		prev_location = ih_location(ih);
 	}
-- 
2.43.0

                 reply	other threads:[~2026-06-11 22:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260611224059.76010-1-kylebot@openai.com \
    --to=kylebot@openai.com \
    --cc=outbounddisclosures@openai.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.