]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.9.144/libceph-weaken-sizeof-check-in-ceph_x_verify_authorizer_reply.patch
Linux 3.18.140
[thirdparty/kernel/stable-queue.git] / releases / 4.9.144 / libceph-weaken-sizeof-check-in-ceph_x_verify_authorizer_reply.patch
CommitLineData
f800b258
GKH
1From foo@baz Thu Dec 6 15:27:31 CET 2018
2From: Ilya Dryomov <idryomov@gmail.com>
3Date: Fri, 27 Jul 2018 19:45:36 +0200
4Subject: libceph: weaken sizeof check in ceph_x_verify_authorizer_reply()
5
6From: Ilya Dryomov <idryomov@gmail.com>
7
8commit f1d10e04637924f2b00a0fecdd2ca4565f5cfc3f upstream.
9
10Allow for extending ceph_x_authorize_reply in the future.
11
12Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
13Reviewed-by: Sage Weil <sage@redhat.com>
14Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
15Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16---
17 net/ceph/auth_x.c | 6 ++++--
18 1 file changed, 4 insertions(+), 2 deletions(-)
19
20--- a/net/ceph/auth_x.c
21+++ b/net/ceph/auth_x.c
22@@ -733,8 +733,10 @@ static int ceph_x_verify_authorizer_repl
23 ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN);
24 if (ret < 0)
25 return ret;
26- if (ret != sizeof(*reply))
27- return -EPERM;
28+ if (ret < sizeof(*reply)) {
29+ pr_err("bad size %d for ceph_x_authorize_reply\n", ret);
30+ return -EINVAL;
31+ }
32
33 if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one))
34 ret = -EPERM;