]> git.itanic.dy.fi Git - linux-stable/commit
ext4: clean up error handling in __ext4_fill_super()
authorTheodore Ts'o <tytso@mit.edu>
Fri, 28 Apr 2023 03:01:41 +0000 (23:01 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 28 Apr 2023 16:56:40 +0000 (12:56 -0400)
commitd4fab7b28e2f5d74790d47a8d298da0abfb5132f
treef9157603e98e7db1583472478a4bbe9b4a4afe9d
parent3b50d5018ed06a647bb26c44bb5ae74e59c903c7
ext4: clean up error handling in __ext4_fill_super()

There were two ways to return an error code; one was via setting the
'err' variable, and the second, if err was zero, was via the 'ret'
variable.  This was both confusing and fragile, and when code was
factored out of __ext4_fill_super(), some of the error codes returned
by the original code was replaced by -EINVAL, and in one case, the
error code was placed by 0, triggering a kernel null pointer
dereference.

Clean this up by removing the 'ret' variable, leaving only one way to
set the error code to be returned, and restore the errno codes that
were returned via the the mount system call as they were before we
started refactoring __ext4_fill_super().

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Jason Yan <yanaijie@huawei.com>
fs/ext4/super.c