diff options
author | Jan Kara <jack@suse.cz> | 2020-12-16 11:18:43 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-01-19 18:22:38 +0100 |
commit | 8e45768d6a279b20fe4c51a41a6d18c54899d0e6 (patch) | |
tree | 393540d9c7a9aa46ac72281a80a4b3486464325c /fs | |
parent | df7adeee7477c865fecdd43b55aee6cca0e9bb0a (diff) | |
download | linux-stable-8e45768d6a279b20fe4c51a41a6d18c54899d0e6.tar.gz linux-stable-8e45768d6a279b20fe4c51a41a6d18c54899d0e6.tar.bz2 linux-stable-8e45768d6a279b20fe4c51a41a6d18c54899d0e6.zip |
ext4: fix superblock checksum failure when setting password salt
commit dfd56c2c0c0dbb11be939b804ddc8d5395ab3432 upstream.
When setting password salt in the superblock, we forget to recompute the
superblock checksum so it will not match until the next superblock
modification which recomputes the checksum. Fix it.
CC: Michael Halcrow <mhalcrow@google.com>
Reported-by: Andreas Dilger <adilger@dilger.ca>
Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support")
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20201216101844.22917-8-jack@suse.cz
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/ioctl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 783c54bb2ce7..21c9ebfe8347 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -1092,7 +1092,10 @@ resizefs_out: err = ext4_journal_get_write_access(handle, sbi->s_sbh); if (err) goto pwsalt_err_journal; + lock_buffer(sbi->s_sbh); generate_random_uuid(sbi->s_es->s_encrypt_pw_salt); + ext4_superblock_csum_set(sb); + unlock_buffer(sbi->s_sbh); err = ext4_handle_dirty_metadata(handle, NULL, sbi->s_sbh); pwsalt_err_journal: |