diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2017-05-19 08:24:36 -0400 |
---|---|---|
committer | Ilya Dryomov <idryomov@gmail.com> | 2017-05-23 14:32:28 -0400 |
commit | b51456a6096ebf9f4ceb2cc7e176b471d4b70af0 (patch) | |
tree | 5f955c4b414044d4cfc1fc6a553e6844049f052b | |
parent | d18a1247c4070390fc0c2d83d89a72afe921882e (diff) |
libceph: fix error handling in process_one_ticket()
Don't leak key internals after new_session_key is populated.
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
-rw-r--r-- | net/ceph/auth_x.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index d0126df33f1f..8757fb87dab8 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c | |||
@@ -151,7 +151,7 @@ static int process_one_ticket(struct ceph_auth_client *ac, | |||
151 | struct timespec validity; | 151 | struct timespec validity; |
152 | void *tp, *tpend; | 152 | void *tp, *tpend; |
153 | void **ptp; | 153 | void **ptp; |
154 | struct ceph_crypto_key new_session_key; | 154 | struct ceph_crypto_key new_session_key = { 0 }; |
155 | struct ceph_buffer *new_ticket_blob; | 155 | struct ceph_buffer *new_ticket_blob; |
156 | unsigned long new_expires, new_renew_after; | 156 | unsigned long new_expires, new_renew_after; |
157 | u64 new_secret_id; | 157 | u64 new_secret_id; |
@@ -237,13 +237,13 @@ static int process_one_ticket(struct ceph_auth_client *ac, | |||
237 | type, ceph_entity_type_name(type), th->secret_id, | 237 | type, ceph_entity_type_name(type), th->secret_id, |
238 | (int)th->ticket_blob->vec.iov_len); | 238 | (int)th->ticket_blob->vec.iov_len); |
239 | xi->have_keys |= th->service; | 239 | xi->have_keys |= th->service; |
240 | 240 | return 0; | |
241 | out: | ||
242 | return ret; | ||
243 | 241 | ||
244 | bad: | 242 | bad: |
245 | ret = -EINVAL; | 243 | ret = -EINVAL; |
246 | goto out; | 244 | out: |
245 | ceph_crypto_key_destroy(&new_session_key); | ||
246 | return ret; | ||
247 | } | 247 | } |
248 | 248 | ||
249 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | 249 | static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, |