ext4: validate the debug_want_extra_isize mount option at parse time
authorTheodore Ts'o <tytso@mit.edu>
Sun, 15 Dec 2019 06:09:03 +0000 (01:09 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Feb 2020 14:43:35 +0000 (14:43 +0000)
commitcb1702c403ad392a9ae6e090702a17cca98a38ca
treee1923634e0fe3e74fbf1ebf6975b80c2065f8b5d
parent1f3b1614c274d9f436d831ea9eefd1f64d9ab82a
ext4: validate the debug_want_extra_isize mount option at parse time

commit 9803387c55f7d2ce69aa64340c5fdc6b3027dbc8 upstream.

Instead of setting s_want_extra_size and then making sure that it is a
valid value afterwards, validate the field before we set it.  This
avoids races and other problems when remounting the file system.

Link: https://lore.kernel.org/r/20191215063020.GA11512@mit.edu
Cc: stable@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reported-and-tested-by: syzbot+4a39a025912b265cacef@syzkaller.appspotmail.com
Signed-off-by: Zubin Mithra <zsm@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/super.c