• Eric Biggers's avatar
    ext4: fix up test_dummy_encryption handling for new mount API · 85456054
    Eric Biggers authored
    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: cebe85d5 ("ext4: switch to the new mount api")
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Link: https://lore.kernel.org/r/20220526040412.173025-1-ebiggers@kernel.orgSigned-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
    85456054
super.c 200 KB