Skip to content

Commit 5b3dbb4

Browse files
committed
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>
1 parent 807c86e commit 5b3dbb4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/ceph/auth_x.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
156156
struct timespec validity;
157157
struct ceph_crypto_key old_key;
158158
void *tp, *tpend;
159+
struct ceph_buffer *new_ticket_blob;
159160

160161
ceph_decode_need(&p, end, sizeof(u32) + 1, bad);
161162

@@ -223,9 +224,12 @@ static int ceph_x_proc_ticket_reply(struct ceph_auth_client *ac,
223224
ceph_decode_need(&tp, tpend, 1 + sizeof(u64), bad);
224225
struct_v = ceph_decode_8(&tp);
225226
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);
227228
if (ret)
228229
goto out;
230+
if (th->ticket_blob)
231+
ceph_buffer_put(th->ticket_blob);
232+
th->ticket_blob = new_ticket_blob;
229233
dout(" got ticket service %d (%s) secret_id %lld len %d\n",
230234
type, ceph_entity_type_name(type), th->secret_id,
231235
(int)th->ticket_blob->vec.iov_len);

0 commit comments

Comments
 (0)