linux-stable/fs/ext4
Constantine Sapuntzakis acaa532687 ext4: fix superblock checksum calculation race
The race condition could cause the persisted superblock checksum
to not match the contents of the superblock, causing the
superblock to be considered corrupt.

An example of the race follows.  A first thread is interrupted in the
middle of a checksum calculation. Then, another thread changes the
superblock, calculates a new checksum, and sets it. Then, the first
thread resumes and sets the checksum based on the older superblock.

To fix, serialize the superblock checksum calculation using the buffer
header lock. While a spinlock is sufficient, the buffer header is
already there and there is precedent for locking it (e.g. in
ext4_commit_super).

Tested the patch by booting up a kernel with the patch, creating
a filesystem and some files (including some orphans), and then
unmounting and remounting the file system.

Cc: stable@kernel.org
Signed-off-by: Constantine Sapuntzakis <costa@purestorage.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Suggested-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20200914161014.22275-1-costa@purestorage.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2020-10-18 10:36:23 -04:00
..
acl.c ext4: handle ext4_mark_inode_dirty errors 2020-06-03 23:16:50 -04:00
acl.h
balloc.c ext4: indicate via a block bitmap read is prefetched via a tracepoint 2020-08-07 14:12:35 -04:00
bitmap.c
block_validity.c ext4: correctly restore system zone info when remount fails 2020-08-07 14:12:37 -04:00
dir.c ext4: avoid utf8_strncasecmp() with unstable name 2020-06-11 11:01:33 -04:00
ext4.h ext4: disallow modifying DAX inode flag if inline_data has been set 2020-10-18 10:36:13 -04:00
ext4_extents.h ext4: fix EXT_MAX_EXTENT/INDEX to check for zeroed eh_max 2020-06-03 23:16:49 -04:00
ext4_jbd2.c ext4: abort the filesystem if failed to async write metadata buffer 2020-08-07 14:12:34 -04:00
ext4_jbd2.h ext4: drop ext4_journal_free_reserved() 2020-06-03 23:16:53 -04:00
extents.c ext4: delete duplicated words + other fixes 2020-10-18 10:36:13 -04:00
extents_status.c ext4: remove unnecessary comparisons to bool 2020-06-03 23:16:49 -04:00
extents_status.h ext4: fix extent_status trace points 2020-01-25 02:03:03 -05:00
file.c ext4: flag as supporting buffered async reads 2020-10-18 10:36:12 -04:00
fsmap.c
fsmap.h
fsync.c A lot of bug fixes and cleanups for ext4, including: 2020-06-05 16:19:28 -07:00
hash.c ext4: change to use fallthrough macro 2020-08-18 14:27:40 -04:00
ialloc.c This is the second round of ext4 commits for 5.8 merge window. It 2020-06-15 09:32:10 -07:00
indirect.c ext4: delete duplicated words + other fixes 2020-10-18 10:36:13 -04:00
inline.c ext4: delete duplicated words + other fixes 2020-10-18 10:36:13 -04:00
inode-test.c kunit: allow kunit tests to be loaded as a module 2020-01-09 16:42:29 -07:00
inode.c ext4: delete duplicated words + other fixes 2020-10-18 10:36:13 -04:00
ioctl.c ext4: limit the length of per-inode prealloc list 2020-08-19 12:04:36 -04:00
Kconfig ext4: replace HTTP links with HTTPS ones 2020-08-06 01:01:57 -04:00
Makefile ext4: support xattr gnu.* namespace for the Hurd 2020-06-12 13:23:34 -04:00
mballoc.c ext4: delete duplicated words + other fixes 2020-10-18 10:36:13 -04:00
mballoc.h ext4: limit the length of per-inode prealloc list 2020-08-19 12:04:36 -04:00
migrate.c ext4: handle ext4_mark_inode_dirty errors 2020-06-03 23:16:50 -04:00
mmp.c ext4: save all error info in save_error_info() and drop ext4_set_errno() 2020-04-01 17:29:06 -04:00
move_extent.c ext4: limit the length of per-inode prealloc list 2020-08-19 12:04:36 -04:00
namei.c ext4: remove unused argument from ext4_(inc|dec)_count 2020-10-18 10:36:13 -04:00
page-io.c ext4: add inline encryption support 2020-07-08 10:29:43 -07:00
readpage.c Improvements to ext4's block allocator performance for very large file 2020-08-21 11:03:38 -07:00
resize.c ext4: fix error handling code in add_new_gdb 2020-10-18 10:36:14 -04:00
super.c ext4: fix superblock checksum calculation race 2020-10-18 10:36:23 -04:00
symlink.c
sysfs.c ext4: limit the length of per-inode prealloc list 2020-08-19 12:04:36 -04:00
truncate.h
verity.c This is the second round of ext4 commits for 5.8 merge window. It 2020-06-15 09:32:10 -07:00
xattr.c ext4: delete unnecessary checks before brelse() 2020-08-06 00:08:56 -04:00
xattr.h ext4: support xattr gnu.* namespace for the Hurd 2020-06-12 13:23:34 -04:00
xattr_hurd.c ext4: support xattr gnu.* namespace for the Hurd 2020-06-12 13:23:34 -04:00
xattr_security.c
xattr_trusted.c
xattr_user.c