diff options
author | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-24 20:19:24 +0100 |
---|---|---|
committer | Ilya Dryomov <ilya.dryomov@inktank.com> | 2013-12-31 19:32:10 +0100 |
commit | b3b33b0e43323af4fb697f4378218d3c268d02cd (patch) | |
tree | a66facb833b060476439c9988b81311e827c35c6 /net/ceph/osdmap.c | |
parent | libceph: update ceph_features.h (diff) | |
download | linux-b3b33b0e43323af4fb697f4378218d3c268d02cd.tar.xz linux-b3b33b0e43323af4fb697f4378218d3c268d02cd.zip |
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 '')
-rw-r--r-- | net/ceph/osdmap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c index dbd9a4792427..6477a68ddecb 100644 --- a/net/ceph/osdmap.c +++ b/net/ceph/osdmap.c @@ -1165,7 +1165,7 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid, } r = crush_do_rule(osdmap->crush, ruleno, pps, osds, min_t(int, pool->size, *num), - osdmap->osd_weight); + osdmap->osd_weight, osdmap->max_osd); if (r < 0) { pr_err("error %d from crush rule: pool %lld ruleset %d type %d" " size %d\n", r, pgid.pool, pool->crush_ruleset, |