From: Ilya Dryomov Date: Fri, 27 Jul 2018 17:45:36 +0000 (+0200) Subject: libceph: weaken sizeof check in ceph_x_verify_authorizer_reply() X-Git-Tag: v4.9.144~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=985a55126453f55299cc55fcfffbeb157eb42c59;p=thirdparty%2Fkernel%2Fstable.git libceph: weaken sizeof check in ceph_x_verify_authorizer_reply() commit f1d10e04637924f2b00a0fecdd2ca4565f5cfc3f upstream. Allow for extending ceph_x_authorize_reply in the future. Signed-off-by: Ilya Dryomov Reviewed-by: Sage Weil Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index fb1dec941aba0..29e23b5cb2edb 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c @@ -733,8 +733,10 @@ static int ceph_x_verify_authorizer_reply(struct ceph_auth_client *ac, ret = ceph_x_decrypt(&au->session_key, &p, p + CEPHX_AU_ENC_BUF_LEN); if (ret < 0) return ret; - if (ret != sizeof(*reply)) - return -EPERM; + if (ret < sizeof(*reply)) { + pr_err("bad size %d for ceph_x_authorize_reply\n", ret); + return -EINVAL; + } if (au->nonce + 1 != le64_to_cpu(reply->nonce_plus_one)) ret = -EPERM;