aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/osdmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ceph/osdmap.c')
-rw-r--r--fs/ceph/osdmap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/fs/ceph/osdmap.c b/fs/ceph/osdmap.c
index 0dbd606e21c4..a143c51c2cfb 100644
--- a/fs/ceph/osdmap.c
+++ b/fs/ceph/osdmap.c
@@ -414,6 +414,7 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
414 struct ceph_osdmap *map; 414 struct ceph_osdmap *map;
415 u16 version; 415 u16 version;
416 u32 len, max, i; 416 u32 len, max, i;
417 u8 ev;
417 int err = -EINVAL; 418 int err = -EINVAL;
418 void *start = *p; 419 void *start = *p;
419 420
@@ -441,10 +442,11 @@ struct ceph_osdmap *osdmap_decode(void **p, void *end)
441 } 442 }
442 ceph_decode_32_safe(p, end, max, bad); 443 ceph_decode_32_safe(p, end, max, bad);
443 while (max--) { 444 while (max--) {
444 ceph_decode_need(p, end, 4+sizeof(map->pg_pool->v), bad); 445 ceph_decode_need(p, end, 4+1+sizeof(map->pg_pool->v), bad);
445 i = ceph_decode_32(p); 446 i = ceph_decode_32(p);
446 if (i >= map->num_pools) 447 if (i >= map->num_pools)
447 goto bad; 448 goto bad;
449 ev = ceph_decode_8(p); /* encoding version */
448 ceph_decode_copy(p, &map->pg_pool[i].v, 450 ceph_decode_copy(p, &map->pg_pool[i].v,
449 sizeof(map->pg_pool->v)); 451 sizeof(map->pg_pool->v));
450 calc_pg_masks(&map->pg_pool[i]); 452 calc_pg_masks(&map->pg_pool[i]);
@@ -603,6 +605,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
603 /* new_pool */ 605 /* new_pool */
604 ceph_decode_32_safe(p, end, len, bad); 606 ceph_decode_32_safe(p, end, len, bad);
605 while (len--) { 607 while (len--) {
608 __u8 ev;
609
606 ceph_decode_32_safe(p, end, pool, bad); 610 ceph_decode_32_safe(p, end, pool, bad);
607 if (pool >= map->num_pools) { 611 if (pool >= map->num_pools) {
608 void *pg_pool = kcalloc(pool + 1, 612 void *pg_pool = kcalloc(pool + 1,
@@ -618,6 +622,8 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
618 map->pg_pool = pg_pool; 622 map->pg_pool = pg_pool;
619 map->num_pools = pool+1; 623 map->num_pools = pool+1;
620 } 624 }
625 ceph_decode_need(p, end, 1 + sizeof(map->pg_pool->v), bad);
626 ev = ceph_decode_8(p); /* encoding version */
621 ceph_decode_copy(p, &map->pg_pool[pool].v, 627 ceph_decode_copy(p, &map->pg_pool[pool].v,
622 sizeof(map->pg_pool->v)); 628 sizeof(map->pg_pool->v));
623 calc_pg_masks(&map->pg_pool[pool]); 629 calc_pg_masks(&map->pg_pool[pool]);