aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorIlya Dryomov <ilya.dryomov@inktank.com>2014-03-13 10:36:14 -0400
committerSage Weil <sage@inktank.com>2014-04-05 00:07:40 -0400
commit3977058c468b872c6bc5e5273bf911d791848643 (patch)
tree8d4d2f0c3e204724cad1295ac88ecb2e3d930a85 /net
parent597b52f6ca247086371abd67e5083292a500e736 (diff)
libceph: safely decode max_osd value in osdmap_decode()
max_osd value is not covered by any ceph_decode_need(). Use a safe version of ceph_decode_* macro to decode it. Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'net')
-rw-r--r--net/ceph/osdmap.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 298d076eee89..ec06010657b3 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -687,9 +687,10 @@ static int osdmap_set_max_osd(struct ceph_osdmap *map, int max)
687static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map) 687static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
688{ 688{
689 u16 version; 689 u16 version;
690 u32 len, max, i;
691 u32 epoch = 0; 690 u32 epoch = 0;
692 void *start = *p; 691 void *start = *p;
692 u32 max;
693 u32 len, i;
693 int err; 694 int err;
694 struct ceph_pg_pool_info *pi; 695 struct ceph_pg_pool_info *pi;
695 696
@@ -736,7 +737,8 @@ static int osdmap_decode(void **p, void *end, struct ceph_osdmap *map)
736 737
737 ceph_decode_32_safe(p, end, map->flags, e_inval); 738 ceph_decode_32_safe(p, end, map->flags, e_inval);
738 739
739 max = ceph_decode_32(p); 740 /* max_osd */
741 ceph_decode_32_safe(p, end, max, e_inval);
740 742
741 /* (re)alloc osd arrays */ 743 /* (re)alloc osd arrays */
742 err = osdmap_set_max_osd(map, max); 744 err = osdmap_set_max_osd(map, max);