A negative pg_upmap or pg_upmap_item value can cause a segfault so
ignore them.
Fixes: http://tracker.ceph.com/issues/22056
Signed-off-by: Brad Hubbard <bhubbard@redhat.com>
(cherry picked from commit
689e1cfba74e9866d411d5d21e0cf0b28343519c)
if (p != pg_upmap.end()) {
// make sure targets aren't marked out
for (auto osd : p->second) {
- if (osd != CRUSH_ITEM_NONE && osd < max_osd && osd_weight[osd] == 0) {
+ if (osd != CRUSH_ITEM_NONE && osd < max_osd && osd >= 0 &&
+ osd_weight[osd] == 0) {
// reject/ignore the explicit mapping
return;
}
if (osd == r.first &&
pos < 0 &&
!(r.second != CRUSH_ITEM_NONE && r.second < max_osd &&
- osd_weight[r.second] == 0)) {
+ r.second >= 0 && osd_weight[r.second] == 0)) {
pos = i;
}
}