]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
ext4: validate s_reserved_gdt_blocks on mount
authorTheodore Ts'o <tytso@mit.edu>
Wed, 6 Jul 2016 00:01:52 +0000 (20:01 -0400)
committerKamal Mostafa <kamal@canonical.com>
Thu, 18 Aug 2016 17:24:18 +0000 (10:24 -0700)
commitc7f47a8413507a00a4a8946ef830024c52acde72
tree700d1e55449f7be49fe679051bb9ef99623ca220
parent40e1487eb5ef6753220ffe9a5fbcd4cd218748b2
ext4: validate s_reserved_gdt_blocks on mount

BugLink: http://bugs.launchpad.net/bugs/1614560
commit 5b9554dc5bf008ae7f68a52e3d7e76c0920938a2 upstream.

If s_reserved_gdt_blocks is extremely large, it's possible for
ext4_init_block_bitmap(), which is called when ext4 sets up an
uninitialized block bitmap, to corrupt random kernel memory.  Add the
same checks which e2fsck has --- it must never be larger than
blocksize / sizeof(__u32) --- and then add a backup check in
ext4_init_block_bitmap() in case the superblock gets modified after
the file system is mounted.

Reported-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
fs/ext4/balloc.c
fs/ext4/super.c