Skip to content

Commit dfd56c2

Browse files
jankaratytso
authored andcommitted
ext4: fix superblock checksum failure when setting password salt
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: 9bd8212 ("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>
1 parent e92ad03 commit dfd56c2

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

fs/ext4/ioctl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,7 +1157,10 @@ static long __ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
11571157
err = ext4_journal_get_write_access(handle, sbi->s_sbh);
11581158
if (err)
11591159
goto pwsalt_err_journal;
1160+
lock_buffer(sbi->s_sbh);
11601161
generate_random_uuid(sbi->s_es->s_encrypt_pw_salt);
1162+
ext4_superblock_csum_set(sb);
1163+
unlock_buffer(sbi->s_sbh);
11611164
err = ext4_handle_dirty_metadata(handle, NULL,
11621165
sbi->s_sbh);
11631166
pwsalt_err_journal:

0 commit comments

Comments
 (0)