提交 7199abcb 编写于 作者: J Jan Kara 提交者: Yang Yingliang

ext4: fix superblock checksum failure when setting password salt

stable inclusion
from linux-4.19.169
commit 8e45768d6a279b20fe4c51a41a6d18c54899d0e6

--------------------------------

commit dfd56c2c 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: NAndreas Dilger <adilger@dilger.ca>
Fixes: 9bd8212f ("ext4 crypto: add encryption policy and password salt support")
Signed-off-by: NJan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20201216101844.22917-8-jack@suse.czSigned-off-by: NTheodore Ts'o <tytso@mit.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: NCheng Jian <cj.chengjian@huawei.com>
上级 db939174
...@@ -1096,7 +1096,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) ...@@ -1096,7 +1096,10 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
err = ext4_journal_get_write_access(handle, sbi->s_sbh); err = ext4_journal_get_write_access(handle, sbi->s_sbh);
if (err) if (err)
goto pwsalt_err_journal; goto pwsalt_err_journal;
lock_buffer(sbi->s_sbh);
generate_random_uuid(sbi->s_es->s_encrypt_pw_salt); 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, err = ext4_handle_dirty_metadata(handle, NULL,
sbi->s_sbh); sbi->s_sbh);
pwsalt_err_journal: pwsalt_err_journal:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册