diff options
| author | Ingo Molnar <[email protected]> | 2017-11-10 07:21:08 +0000 |
|---|---|---|
| committer | Ingo Molnar <[email protected]> | 2017-11-10 07:21:08 +0000 |
| commit | b5cd3b51e247473e290be5cd09e77171e466cd89 (patch) | |
| tree | ac8c87e1b38f61a4c879c574dc9373db41f3df01 /fs/ecryptfs/ecryptfs_kernel.h | |
| parent | x86/platform/UV: Convert timers to use timer_setup() (diff) | |
| parent | Merge branch 'akpm' (patches from Andrew) (diff) | |
| download | kernel-b5cd3b51e247473e290be5cd09e77171e466cd89.tar.gz kernel-b5cd3b51e247473e290be5cd09e77171e466cd89.zip | |
Merge branch 'linus' into x86/platform, to refresh the branch
Signed-off-by: Ingo Molnar <[email protected]>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
| -rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 9c351bf757b2..3fbc0ff79699 100644 --- a/fs/ecryptfs/ecryptfs_kernel.h +++ b/fs/ecryptfs/ecryptfs_kernel.h @@ -84,11 +84,16 @@ struct ecryptfs_page_crypt_context { static inline struct ecryptfs_auth_tok * ecryptfs_get_encrypted_key_payload_data(struct key *key) { - if (key->type == &key_type_encrypted) - return (struct ecryptfs_auth_tok *) - (&((struct encrypted_key_payload *)key->payload.data[0])->payload_data); - else + struct encrypted_key_payload *payload; + + if (key->type != &key_type_encrypted) return NULL; + + payload = key->payload.data[0]; + if (!payload) + return ERR_PTR(-EKEYREVOKED); + + return (struct ecryptfs_auth_tok *)payload->payload_data; } static inline struct key *ecryptfs_get_encrypted_key(char *sig) @@ -114,12 +119,17 @@ static inline struct ecryptfs_auth_tok * ecryptfs_get_key_payload_data(struct key *key) { struct ecryptfs_auth_tok *auth_tok; + struct user_key_payload *ukp; auth_tok = ecryptfs_get_encrypted_key_payload_data(key); - if (!auth_tok) - return (struct ecryptfs_auth_tok *)user_key_payload_locked(key)->data; - else + if (auth_tok) return auth_tok; + + ukp = user_key_payload_locked(key); + if (!ukp) + return ERR_PTR(-EKEYREVOKED); + + return (struct ecryptfs_auth_tok *)ukp->data; } #define ECRYPTFS_MAX_KEYSET_SIZE 1024 |
