From 88cfa0464dc86d088e0f8484bc15a279d83919e9 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 28 Apr 2025 13:53:40 +0200 Subject: ext2fs: fix crash on ENOSPC 54c0b9b9dbf7 ("ext2fs: Trap trying to access bogus data areas") added checks on the allocated block number, but did not take care of the out-of-space condition, which callers of ext2_new_block and ext2_alloc_block know to handle. --- ext2fs/balloc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext2fs/balloc.c') diff --git a/ext2fs/balloc.c b/ext2fs/balloc.c index 231ab589..0957f19e 100644 --- a/ext2fs/balloc.c +++ b/ext2fs/balloc.c @@ -407,8 +407,9 @@ got_block: alloc_sync (0); /* Trap trying to allocate superblock, block group descriptor table, or beyond the end */ - assert_backtrace (j >= group_desc_block_end - && j < store->size >> log2_block_size); + assert_backtrace (j == 0 || + (j >= group_desc_block_end + && j < store->size >> log2_block_size)); return j; } -- cgit v1.2.3