diff options
author | Amit Pundir <amit.pundir@linaro.org> | 2017-11-20 21:48:45 +0530 |
---|---|---|
committer | Amit Pundir <amit.pundir@linaro.org> | 2017-11-20 21:48:45 +0530 |
commit | baa6b7f93aec81644160ca02a8a6a5ae3be4ce85 (patch) | |
tree | 2a6bf027912ae74a354ce3b7d460d04ccfac4e55 /fs/ecryptfs/ecryptfs_kernel.h | |
parent | 7bc703cde6592016ed3eadd8bd592ee9adbe6647 (diff) | |
parent | f409333f361fed0c71c479b2a0c4e032d496cd94 (diff) |
Merge branch 'linux-linaro-lsk-v3.18' into linux-linaro-lsk-v3.18-androidlsk-v3.18-18.03-androidlsk-v3.18-18.02-androidlsk-v3.18-17.11-androidlinux-linaro-lsk-v3.18-android
Conflicts:
net/packet/af_packet.c
Fix conflicts by refactoring changes from LTS commit
e4ffdf9ead59 ("packet: hold bind lock when rebinding to fanout hook"),
to align with the changes from AOSP commit 6bec212418d2
("UPSTREAM: packet: fix races in fanout_add()").
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'fs/ecryptfs/ecryptfs_kernel.h')
-rw-r--r-- | fs/ecryptfs/ecryptfs_kernel.h | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h index 90d1882b306f..4682bef34bb6 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)->payload_data); - else + struct encrypted_key_payload *payload; + + if (key->type != &key_type_encrypted) return NULL; + + payload = key->payload.data; + 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,13 +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 *) - (((struct user_key_payload *)key->payload.data)->data); - else + if (auth_tok) return auth_tok; + + ukp = key->payload.data; + if (!ukp) + return ERR_PTR(-EKEYREVOKED); + + return (struct ecryptfs_auth_tok *)ukp->data; } #define ECRYPTFS_MAX_KEYSET_SIZE 1024 |