]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw:segmentation fault when rgw_gc_max_objs > HASH_PRIME 5449/head
authorRuifeng Yang <149233652@qq.com>
Sun, 2 Aug 2015 08:16:05 +0000 (16:16 +0800)
committerRuifeng Yang <149233652@qq.com>
Fri, 7 Aug 2015 00:27:24 +0000 (08:27 +0800)
obj_names[] is index out of bounds when rgw_gc_max_objs > HASH_PRIME

Fixes: #12630
Signed-off-by: Ruifeng Yang <149233652@qq.com>
src/rgw/rgw_gc.cc

index 70f5691d6d4410de55871f87950b53e87988a7d8..3a949b6821aa44d7a78079505c3b8949534cb3e4 100644 (file)
@@ -95,7 +95,7 @@ int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std
 {
   result.clear();
 
-  for (; *index < cct->_conf->rgw_gc_max_objs && result.size() < max; (*index)++, marker.clear()) {
+  for (; *index < max_objs && result.size() < max; (*index)++, marker.clear()) {
     std::list<cls_rgw_gc_obj_info> entries;
     int ret = cls_rgw_gc_list(store->gc_pool_ctx, obj_names[*index], marker, max - result.size(), expired_only, entries, truncated);
     if (ret == -ENOENT)
@@ -108,7 +108,7 @@ int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std
       result.push_back(*iter);
     }
 
-    if (*index == cct->_conf->rgw_gc_max_objs - 1) {
+    if (*index == max_objs - 1) {
       /* we cut short here, truncated will hold the correct value */
       return 0;
     }
@@ -234,7 +234,6 @@ done:
 
 int RGWGC::process()
 {
-  int max_objs = cct->_conf->rgw_gc_max_objs;
   int max_secs = cct->_conf->rgw_gc_processor_max_time;
 
   unsigned start;