diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-24 14:19:24 -0500 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-31 13:32:10 -0500 |
commit | b3b33b0e43323af4fb697f4378218d3c268d02cd (patch) | |
tree | a66facb833b060476439c9988b81311e827c35c6 /include | |
parent | 2b3e0c905af43cfe402a2ef3f800be5dc1684005 (diff) |
crush: pass weight vector size to map function
Pass the size of the weight vector into crush_do_rule() to ensure that we
don't access values past the end. This can happen if the caller misbehaves
and passes a weight vector that is smaller than max_devices.
Currently the monitor tries to prevent that from happening, but this will
gracefully tolerate previous bad osdmaps that got into this state. It's
also a bit more defensive.
Reflects ceph.git commit 5922e2c2b8335b5e46c9504349c3a55b7434c01a.
Signed-off-by: Ilya Dryomov <ilya.dryomov@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/crush/mapper.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/linux/crush/mapper.h b/include/linux/crush/mapper.h index 5772dee3ecbf..69310b031875 100644 --- a/include/linux/crush/mapper.h +++ b/include/linux/crush/mapper.h | |||
@@ -14,6 +14,6 @@ extern int crush_find_rule(const struct crush_map *map, int ruleset, int type, i | |||
14 | extern int crush_do_rule(const struct crush_map *map, | 14 | extern int crush_do_rule(const struct crush_map *map, |
15 | int ruleno, | 15 | int ruleno, |
16 | int x, int *result, int result_max, | 16 | int x, int *result, int result_max, |
17 | const __u32 *weights); | 17 | const __u32 *weights, int weight_max); |
18 | 18 | ||
19 | #endif | 19 | #endif |