From 3b1ada55b905f306411f481df52b586cc8a407b8 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 9 Dec 2019 13:23:48 -0800 Subject: [PATCH] fscrypt: don't check for ENOKEY from fscrypt_get_encryption_info() fscrypt_get_encryption_info() returns 0 if the encryption key is unavailable; it never returns ENOKEY. So remove checks for ENOKEY. Link: https://lore.kernel.org/r/20191209212348.243331-1-ebiggers@kernel.org Signed-off-by: Eric Biggers --- fs/ext4/dir.c | 2 +- fs/f2fs/dir.c | 2 +- fs/ubifs/dir.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index 9f00fc0bf21d..4e093277c8bf 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c @@ -120,7 +120,7 @@ static int ext4_readdir(struct file *file, struct dir_context *ctx) if (IS_ENCRYPTED(inode)) { err = fscrypt_get_encryption_info(inode); - if (err && err != -ENOKEY) + if (err) return err; } diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index c967cacf979e..d9ad842945df 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c @@ -987,7 +987,7 @@ static int f2fs_readdir(struct file *file, struct dir_context *ctx) if (IS_ENCRYPTED(inode)) { err = fscrypt_get_encryption_info(inode); - if (err && err != -ENOKEY) + if (err) goto out; err = fscrypt_fname_alloc_buffer(inode, F2FS_NAME_LEN, &fstr); diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 0b98e3c8b461..acc4f942d25b 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -512,7 +512,7 @@ static int ubifs_readdir(struct file *file, struct dir_context *ctx) if (encrypted) { err = fscrypt_get_encryption_info(dir); - if (err && err != -ENOKEY) + if (err) return err; err = fscrypt_fname_alloc_buffer(dir, UBIFS_MAX_NLEN, &fstr);