crush: ensure bucket id is valid before indexing buckets array
authorIlya Dryomov <idryomov@gmail.com>
Sun, 31 Jan 2016 13:35:59 +0000 (14:35 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 4 Feb 2016 17:25:23 +0000 (18:25 +0100)
commitf224a6915f266921507bb6e50a82f87a3de5b4b5
tree01ec95389acdeba3651745a1a9457d976c011152
parentdb6aed70235b35a113e1b0e81cb293fd2e92de0f
crush: ensure bucket id is valid before indexing buckets array

We were indexing the buckets array without verifying the index was
within the [0,max_buckets) range.  This could happen because
a multistep rule does not have enough buckets and has CRUSH_ITEM_NONE
for an intermediate result, which would feed in CRUSH_ITEM_NONE and
make us crash.

Reflects ceph.git commit 976a24a326da8931e689ee22fce35feab5b67b76.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Reviewed-by: Sage Weil <sage@redhat.com>
net/ceph/crush/mapper.c