]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ext4: verify orphan file size is not too big
authorJan Kara <jack@suse.cz>
Tue, 9 Sep 2025 11:22:07 +0000 (13:22 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:23:18 +0000 (16:23 +0200)
commit566a1d6084563bd07433025aa23bcea4427de107
tree8261e585caf3e04f282c3891cd7e54cd2a76796e
parent4716a38d502fef7a31dd17b3991f22bd0b0f5095
ext4: verify orphan file size is not too big

commit 0a6ce20c156442a4ce2a404747bb0fb05d54eeb3 upstream.

In principle orphan file can be arbitrarily large. However orphan replay
needs to traverse it all and we also pin all its buffers in memory. Thus
filesystems with absurdly large orphan files can lead to big amounts of
memory consumed. Limit orphan file size to a sane value and also use
kvmalloc() for allocating array of block descriptor structures to avoid
large order allocations for sane but large orphan files.

Reported-by: syzbot+0b92850d68d9b12934f5@syzkaller.appspotmail.com
Fixes: 02f310fcf47f ("ext4: Speedup ext4 orphan inode handling")
Cc: stable@kernel.org
Signed-off-by: Jan Kara <jack@suse.cz>
Message-ID: <20250909112206.10459-2-jack@suse.cz>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/orphan.c