ext4: fix in-superblock mount options processing
authorTheodore Ts'o <tytso@mit.edu>
Fri, 18 Nov 2016 18:24:26 +0000 (13:24 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 16 Mar 2017 02:18:26 +0000 (02:18 +0000)
commit164351a13aa59a3d0d9fec7061e4e96bd44f1143
tree1bca130037020ccbeb795ed58fd43e96c7ec488e
parent765358f2601d3d0c8fe504da9e5ab4fd6a257043
ext4: fix in-superblock mount options processing

commit 5aee0f8a3f42c94c5012f1673420aee96315925a upstream.

Fix a large number of problems with how we handle mount options in the
superblock.  For one, if the string in the superblock is long enough
that it is not null terminated, we could run off the end of the string
and try to interpret superblocks fields as characters.  It's unlikely
this will cause a security problem, but it could result in an invalid
parse.  Also, parse_options is destructive to the string, so in some
cases if there is a comma-separated string, it would be modified in
the superblock.  (Fortunately it only happens on file systems with a
1k block size.)

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
[bwh: Backported to 3.2: adjust context, indentation]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/ext4/super.c