diff options
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 { | |||
84 | static inline struct ecryptfs_auth_tok * | 84 | static inline struct ecryptfs_auth_tok * |
85 | ecryptfs_get_encrypted_key_payload_data(struct key *key) | 85 | ecryptfs_get_encrypted_key_payload_data(struct key *key) |
86 | { | 86 | { |
87 | if (key->type == &key_type_encrypted) | 87 | struct encrypted_key_payload *payload; |
88 | return (struct ecryptfs_auth_tok *) | 88 | |
89 | (&((struct encrypted_key_payload *)key->payload.data[0])->payload_data); | 89 | if (key->type != &key_type_encrypted) |
90 | else | ||
91 | return NULL; | 90 | return NULL; |
91 | |||
92 | payload = key->payload.data[0]; | ||
93 | if (!payload) | ||
94 | return ERR_PTR(-EKEYREVOKED); | ||
95 | |||
96 | return (struct ecryptfs_auth_tok *)payload->payload_data; | ||
92 | } | 97 | } |
93 | 98 | ||
94 | static inline struct key *ecryptfs_get_encrypted_key(char *sig) | 99 | static inline struct key *ecryptfs_get_encrypted_key(char *sig) |
@@ -114,12 +119,17 @@ static inline struct ecryptfs_auth_tok * | |||
114 | ecryptfs_get_key_payload_data(struct key *key) | 119 | ecryptfs_get_key_payload_data(struct key *key) |
115 | { | 120 | { |
116 | struct ecryptfs_auth_tok *auth_tok; | 121 | struct ecryptfs_auth_tok *auth_tok; |
122 | struct user_key_payload *ukp; | ||
117 | 123 | ||
118 | auth_tok = ecryptfs_get_encrypted_key_payload_data(key); | 124 | auth_tok = ecryptfs_get_encrypted_key_payload_data(key); |
119 | if (!auth_tok) | 125 | if (auth_tok) |
120 | return (struct ecryptfs_auth_tok *)user_key_payload_locked(key)->data; | ||
121 | else | ||
122 | return auth_tok; | 126 | return auth_tok; |
127 | |||
128 | ukp = user_key_payload_locked(key); | ||
129 | if (!ukp) | ||
130 | return ERR_PTR(-EKEYREVOKED); | ||
131 | |||
132 | return (struct ecryptfs_auth_tok *)ukp->data; | ||
123 | } | 133 | } |
124 | 134 | ||
125 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 | 135 | #define ECRYPTFS_MAX_KEYSET_SIZE 1024 |