diff options
author | Theodore Ts'o <tytso@mit.edu> | 2015-05-31 13:35:39 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2015-05-31 13:35:39 -0400 |
commit | abdd438b26b409eaccf9c847fcf9c3ab52f1959e (patch) | |
tree | 4473a3667ab265065f0ce81b49d76e8c095b19d2 /fs/ext4/crypto.c | |
parent | 4d3c4e5b8cae3bb45ba933a22670504239958aa1 (diff) | |
download | op-kernel-dev-abdd438b26b409eaccf9c847fcf9c3ab52f1959e.zip op-kernel-dev-abdd438b26b409eaccf9c847fcf9c3ab52f1959e.tar.gz |
ext4 crypto: handle unexpected lack of encryption keys
Fix up attempts by users to try to write to a file when they don't
have access to the encryption key.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/crypto.c')
-rw-r--r-- | fs/ext4/crypto.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c index 1c9a8c4..efcb7c0 100644 --- a/fs/ext4/crypto.c +++ b/fs/ext4/crypto.c @@ -104,7 +104,8 @@ struct ext4_crypto_ctx *ext4_get_crypto_ctx(struct inode *inode) unsigned long flags; struct ext4_crypt_info *ci = EXT4_I(inode)->i_crypt_info; - BUG_ON(ci == NULL); + if (ci == NULL) + return ERR_PTR(-ENOKEY); /* * We first try getting the ctx from a free list because in |