linux/fs/crypto
Hongjie Fang 0fc3e9b9b6 fscrypt: don't set policy for a dead directory
commit 5858bdad4d upstream.

The directory may have been removed when entering
fscrypt_ioctl_set_policy().  If so, the empty_dir() check will return
error for ext4 file system.

ext4_rmdir() sets i_size = 0, then ext4_empty_dir() reports an error
because 'inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)'.  If
the fs is mounted with errors=panic, it will trigger a panic issue.

Add the check IS_DEADDIR() to fix this problem.

Fixes: 9bd8212f98 ("ext4 crypto: add encryption policy and password salt support")
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Hongjie Fang <hongjiefang@asrmicro.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-14 08:11:16 +02:00
..
bio.c fscrypt: allow synchronous bio decryption 2018-05-02 14:30:57 -07:00
crypto.c f2fs-for-4.18-rc1 2018-06-11 10:16:13 -07:00
fname.c fscrypt: use a common logging function 2018-05-20 16:21:05 -04:00
fscrypt_private.h crypto: speck - remove Speck 2018-11-13 11:08:46 -08:00
hooks.c fscrypt: use a common logging function 2018-05-20 16:21:05 -04:00
Kconfig fscrypt: add support for AES-128-CBC 2017-06-23 20:05:07 -04:00
keyinfo.c crypto: speck - remove Speck 2018-11-13 11:08:46 -08:00
Makefile fscrypt: new helper function - fscrypt_file_open() 2017-10-18 19:52:37 -04:00
policy.c fscrypt: don't set policy for a dead directory 2019-07-14 08:11:16 +02:00