]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix up test_dummy_encryption handling for new mount API
authorEric Biggers <ebiggers@google.com>
Thu, 26 May 2022 04:04:12 +0000 (21:04 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 18 Jun 2022 23:35:43 +0000 (19:35 -0400)
commit93311367b3599b070f3dea6fdbabd4dc677bb6d7
treec01c9d64c0452d12b1603bd287eafa5462f18136
parent60d9bdc58110a95c5bd3cb4e14df5fb44c187afe
ext4: fix up test_dummy_encryption handling for new mount API

Since ext4 was converted to the new mount API, the test_dummy_encryption
mount option isn't being handled entirely correctly, because the needed
fscrypt_set_test_dummy_encryption() helper function combines
parsing/checking/applying into one function.  That doesn't work well
with the new mount API, which split these into separate steps.

This was sort of okay anyway, due to the parsing logic that was copied
from fscrypt_set_test_dummy_encryption() into ext4_parse_param(),
combined with an additional check in ext4_check_test_dummy_encryption().
However, these overlooked the case of changing the value of
test_dummy_encryption on remount, which isn't allowed but ext4 wasn't
detecting until ext4_apply_options() when it's too late to fail.
Another bug is that if test_dummy_encryption was specified multiple
times with an argument, memory was leaked.

Fix this up properly by using the new helper functions that allow
splitting up the parse/check/apply steps for test_dummy_encryption.

Fixes: 75f79933b808 ("ext4: switch to the new mount api")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20220526040412.173025-1-ebiggers@kernel.org
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/super.c