diff options
author | Sage Weil <sage@newdream.net> | 2010-03-15 18:57:04 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-03-21 00:33:11 -0400 |
commit | 5b3dbb44ab40660a080d03585bd35f45b2890c49 (patch) | |
tree | 4303e51cf6922c92ea8a60217f5694d83de06a3a /fs | |
parent | 807c86e2ceba8febe79b289d50cd0d5e0b0af917 (diff) |
ceph: release old ticket_blob buffer
Release the old ticket_blob buffer when we get an updated service ticket
from the monitor. Previously these were getting leaked.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/auth_x.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/ceph/auth_x.c b/fs/ceph/auth_x.c index 96e7aaa77678..33d3ad4dc456 100644 --- a/fs/ceph/auth_x.c +++ b/fs/ceph/auth_x.c | |||
@@ -156,6 +156,7 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | |||
156 | struct timespec validity; | 156 | struct timespec validity; |
157 | struct ceph_crypto_key old_key; | 157 | struct ceph_crypto_key old_key; |
158 | void *tp, *tpend; | 158 | void *tp, *tpend; |
159 | struct ceph_buffer *new_ticket_blob; | ||
159 | 160 | ||
160 | ceph_decode_need(&p, end, sizeof(u32) + 1, bad); | 161 | ceph_decode_need(&p, end, sizeof(u32) + 1, bad); |
161 | 162 | ||
@@ -223,9 +224,12 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac, | |||
223 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); | 224 | ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad); |
224 | struct_v = ceph_decode_8(&tp); | 225 | struct_v = ceph_decode_8(&tp); |
225 | th->secret_id = ceph_decode_64(&tp); | 226 | th->secret_id = ceph_decode_64(&tp); |
226 | ret = ceph_decode_buffer(&th->ticket_blob, &tp, tpend); | 227 | ret = ceph_decode_buffer(&new_ticket_blob, &tp, tpend); |
227 | if (ret) | 228 | if (ret) |
228 | goto out; | 229 | goto out; |
230 | if (th->ticket_blob) | ||
231 | ceph_buffer_put(th->ticket_blob); | ||
232 | th->ticket_blob = new_ticket_blob; | ||
229 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", | 233 | dout(" got ticket service %d (%s) secret_id %lld len %d\n", |
230 | type, ceph_entity_type_name(type), th->secret_id, | 234 | type, ceph_entity_type_name(type), th->secret_id, |
231 | (int)th->ticket_blob->vec.iov_len); | 235 | (int)th->ticket_blob->vec.iov_len); |