]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crush/mapper: ensure take bucket value is valid 6246/head
authorSage Weil <sage@redhat.com>
Tue, 13 Oct 2015 13:55:01 +0000 (09:55 -0400)
committerSage Weil <sage@redhat.com>
Wed, 28 Oct 2015 00:55:29 +0000 (20:55 -0400)
Ensure that the take argument is a valid bucket ID before indexing the
buckets array.

Signed-off-by: Sage Weil <sage@redhat.com>
src/crush/mapper.c

index 5fc7d33a6dcc643946e71d19400f3079ee26576e..412e7e83b21a7dea25124c4f73c7c8bc2818590b 100644 (file)
@@ -835,7 +835,8 @@ int crush_do_rule(const struct crush_map *map,
                case CRUSH_RULE_TAKE:
                        if ((curstep->arg1 >= 0 &&
                             curstep->arg1 < map->max_devices) ||
-                           (-1-curstep->arg1 < map->max_buckets &&
+                           (-1-curstep->arg1 >= 0 &&
+                            -1-curstep->arg1 < map->max_buckets &&
                             map->buckets[-1-curstep->arg1])) {
                                w[0] = curstep->arg1;
                                wsize = 1;