Skip to content

Commit 36721ec

Browse files
committed
libceph: ceph_x_encrypt_buflen() takes in_len
Pass what's going to be encrypted - that's msg_b, not ticket_blob. ceph_x_encrypt_buflen() returns the upper bound, so this doesn't change the maxlen calculation, but makes it a bit clearer. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Reviewed-by: Sage Weil <sage@redhat.com>
1 parent 69973b8 commit 36721ec

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

net/ceph/auth_x.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
308308
if (ret)
309309
goto out_au;
310310

311-
maxlen = sizeof(*msg_a) + sizeof(msg_b) +
312-
ceph_x_encrypt_buflen(ticket_blob_len);
311+
maxlen = sizeof(*msg_a) + ticket_blob_len +
312+
ceph_x_encrypt_buflen(sizeof(msg_b));
313313
dout(" need len %d\n", maxlen);
314314
if (au->buf && au->buf->alloc_len < maxlen) {
315315
ceph_buffer_put(au->buf);
@@ -350,11 +350,12 @@ static int ceph_x_build_authorizer(struct ceph_auth_client *ac,
350350
p, end - p);
351351
if (ret < 0)
352352
goto out_au;
353+
353354
p += ret;
355+
WARN_ON(p > end);
354356
au->buf->vec.iov_len = p - au->buf->vec.iov_base;
355357
dout(" built authorizer nonce %llx len %d\n", au->nonce,
356358
(int)au->buf->vec.iov_len);
357-
BUG_ON(au->buf->vec.iov_len > maxlen);
358359
return 0;
359360

360361
out_au:

0 commit comments

Comments
 (0)