libceph: fix misjudgement of maximum monitor number
authorChengguang Xu <cgxu519@icloud.com>
Sun, 11 Feb 2018 01:33:28 +0000 (09:33 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 2 Apr 2018 08:12:45 +0000 (10:12 +0200)
num_mon should allow up to CEPH_MAX_MON in ceph_monmap_decode().

Signed-off-by: Chengguang Xu <cgxu519@icloud.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/mon_client.c

index 1547107..b3dac24 100644 (file)
@@ -60,7 +60,7 @@ struct ceph_monmap *ceph_monmap_decode(void *p, void *end)
        num_mon = ceph_decode_32(&p);
        ceph_decode_need(&p, end, num_mon*sizeof(m->mon_inst[0]), bad);
 
-       if (num_mon >= CEPH_MAX_MON)
+       if (num_mon > CEPH_MAX_MON)
                goto bad;
        m = kmalloc(sizeof(*m) + sizeof(m->mon_inst[0])*num_mon, GFP_NOFS);
        if (m == NULL)