]> git.baikalelectronics.ru Git - kernel.git/commit
fscrypt: fix race allowing rename() and link() of ciphertext dentries
authorEric Biggers <ebiggers@google.com>
Wed, 20 Mar 2019 18:39:10 +0000 (11:39 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 17 Apr 2019 13:51:20 +0000 (09:51 -0400)
commit536a6b1f21ec832b33fcdf8ff95a1afe8f7d665b
tree747e028b00d4453e8de1b8959b739517e025efb0
parentdc802e7e1026df6826c34774fa34ada922ec0f4c
fscrypt: fix race allowing rename() and link() of ciphertext dentries

Close some race conditions where fscrypt allowed rename() and link() on
ciphertext dentries that had been looked up just prior to the key being
concurrently added.  It's better to return -ENOKEY in this case.

This avoids doing the nonsensical thing of encrypting the names a second
time when searching for the actual on-disk dir entries.  It also
guarantees that DCACHE_ENCRYPTED_NAME dentries are never rename()d, so
the dcache won't have support all possible combinations of moving
DCACHE_ENCRYPTED_NAME around during __d_move().

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/crypto/hooks.c
include/linux/fscrypt.h