diff options
author | Ilya Dryomov <idryomov@gmail.com> | 2018-07-27 19:40:30 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-05 19:41:27 +0100 |
commit | 0c5f2e899241aceab46e6dcba01c6fb2223bdeb5 (patch) | |
tree | 7409b9ee8e87234ec9a3a8ae196e79c9492429ea | |
parent | 14118df4e7b4738815f222f5b20fceb3957ab206 (diff) |
libceph: check authorizer reply/challenge length before reading
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>
-rw-r--r-- | net/ceph/messenger.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index ad33baa2008d..f864807284d4 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -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); |