]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crush: fix map->choose_tries boundary test 922/head
authorLoic Dachary <loic@dachary.org>
Sun, 8 Dec 2013 13:38:59 +0000 (14:38 +0100)
committerLoic Dachary <loic@dachary.org>
Sun, 8 Dec 2013 16:00:54 +0000 (17:00 +0100)
CrushWrapper::start_choose_profile allocates map->choose_tries with
choose_total_tries elements. When crush_choose_firstn sets a value, it
tests against map->choose_local_tries which could lead to memory
corruption if map->choose_total_tries is smaller than
map->choose_local_tries.

Another indesirable but non fatal side effect is that the output crushtool
--show-choose-tries will be truncated to choose_local_tries which is
set to a lower value than choose_total_tries by the default tuneables.

Signed-off-by: Loic Dachary <loic@dachary.org>
src/crush/mapper.c

index 3ae3724a98df5ce8ac8832c2fae6eff834429019..0c21ddddbd75d7bb4a9d98984f504b4ccad19ba9 100644 (file)
@@ -443,7 +443,7 @@ reject:
                out[outpos] = item;
                outpos++;
 
-               if (map->choose_tries && ftotal <= map->choose_local_tries)
+               if (map->choose_tries && ftotal <= map->choose_total_tries)
                        map->choose_tries[ftotal]++;
        }