From: Ilya Dryomov Date: Fri, 27 Jul 2018 17:40:30 +0000 (+0200) Subject: libceph: check authorizer reply/challenge length before reading X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=130f52f2b203aa0aec179341916ffb2e905f3afd;p=linux.git libceph: check authorizer reply/challenge length before reading Avoid scribbling over memory if the received reply/challenge is larger than the buffer supplied with the authorizer. Signed-off-by: Ilya Dryomov Reviewed-by: Sage Weil --- diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index e915c8bce1176..0a187196aeede 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1782,6 +1782,13 @@ static int read_partial_connect(struct ceph_connection *con) if (con->auth) { size = le32_to_cpu(con->in_reply.authorizer_len); + if (size > con->auth->authorizer_reply_buf_len) { + pr_err("authorizer reply too big: %d > %zu\n", size, + con->auth->authorizer_reply_buf_len); + ret = -EINVAL; + goto out; + } + end += size; ret = read_partial(con, end, size, con->auth->authorizer_reply_buf);