]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
libceph: check authorizer reply/challenge length before reading
authorIlya Dryomov <idryomov@gmail.com>
Fri, 27 Jul 2018 17:40:30 +0000 (19:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 5 Dec 2018 18:41:27 +0000 (19:41 +0100)
commit 130f52f2b203aa0aec179341916ffb2e905f3afd upstream.

Avoid scribbling over memory if the received reply/challenge is larger
than the buffer supplied with the authorizer.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ceph/messenger.c

index ad33baa2008de85f4683bf042bd5ea18884b3170..f864807284d44b12a0b7926f84732926b4a53347 100644 (file)
@@ -1754,6 +1754,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);