ext2: Use kvmalloc() for group descriptor array
authorJan Kara <jack@suse.cz>
Wed, 14 Sep 2022 15:29:33 +0000 (17:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 26 Oct 2022 10:35:51 +0000 (12:35 +0200)
commitb9b5560b342e40bd6a0a131fb1bd99684ee8f1e7
treeb15df35bd17afca8609642de6b45540a36d6ed9e
parent8c067a3051cdadf93c03c1d1863975c9c18d7472
ext2: Use kvmalloc() for group descriptor array

[ Upstream commit e7c7fbb9a8574ebd89cc05db49d806c7476863ad ]

Array of group descriptor block buffers can get rather large. In theory
in can reach 1MB for perfectly valid filesystem and even more for
maliciously crafted ones. Use kvmalloc() to allocate the array to avoid
straining memory allocator with large order allocations unnecessarily.

Reported-by: syzbot+0f2f7e65a3007d39539f@syzkaller.appspotmail.com
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/ext2/super.c