Skip to content

Commit 7fce830

Browse files
ziming zhangidryomov
authored andcommitted
libceph: prevent potential out-of-bounds writes in handle_auth_session_key()
The len field originates from untrusted network packets. Boundary checks have been added to prevent potential out-of-bounds writes when decrypting the connection secret or processing service tickets. [ idryomov: changelog ] Cc: stable@vger.kernel.org Signed-off-by: ziming zhang <ezrakiez@gmail.com> Reviewed-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
1 parent ec3797f commit 7fce830

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/ceph/auth_x.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
631631

632632
/* connection secret */
633633
ceph_decode_32_safe(p, end, len, e_inval);
634+
ceph_decode_need(p, end, len, e_inval);
634635
dout("%s connection secret blob len %d\n", __func__, len);
635636
if (len > 0) {
636637
dp = *p + ceph_x_encrypt_offset();
@@ -648,6 +649,7 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
648649

649650
/* service tickets */
650651
ceph_decode_32_safe(p, end, len, e_inval);
652+
ceph_decode_need(p, end, len, e_inval);
651653
dout("%s service tickets blob len %d\n", __func__, len);
652654
if (len > 0) {
653655
ret = ceph_x_proc_ticket_reply(ac, &th->session_key,

0 commit comments

Comments
 (0)