]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix not initialized pointer which cause rgw crash with ec data pool 17164/head
authorAleksei Gutikov <aleksey.gutikov@synesis.ru>
Thu, 6 Jul 2017 08:27:42 +0000 (11:27 +0300)
committerNathan Cutler <ncutler@suse.com>
Tue, 22 Aug 2017 19:26:53 +0000 (21:26 +0200)
In RGWPutObjProcessor_Atomic::complete_writing_data()
with pending_data_bl.length() > 0 and next_part_ofs==data_ofs
not initialized void *handle leads to invalid pointer librados::AioCompletion::pc
which leads to rgw crash.

Fixes: http://tracker.ceph.com/issues/20542
Signed-off-by: Aleksei Gutikov <aleksey.gutikov@synesis.ru>
(cherry picked from commit 3e938dd9fe681fa8652dc4b0ec1dc56781d884c0)

Conflicts:
src/rgw/rgw_rados.cc (trivial resolution)

src/rgw/rgw_rados.cc

index 598d2564ad31214ce19f8f14fcf130913026ebc2..8e9a064fc1b81861d9a77a2d3d902e42e4968f66 100644 (file)
@@ -2310,8 +2310,10 @@ int RGWPutObjProcessor_Atomic::write_data(bufferlist& bl, off_t ofs, void **phan
 
   *pobj = cur_obj;
 
-  if (!bl.length())
+  if (!bl.length()) {
+    *phandle = nullptr;
     return 0;
+  }
 
   return RGWPutObjProcessor_Aio::handle_obj_data(cur_obj, bl, ofs - cur_part_ofs, ofs, phandle, exclusive);
 }
@@ -2452,7 +2454,7 @@ int RGWPutObjProcessor_Atomic::complete_writing_data()
     obj_len = (uint64_t)first_chunk.length();
   }
   while (pending_data_bl.length()) {
-    void *handle;
+    void *handle = nullptr;
     rgw_obj obj;
     uint64_t max_write_size = MIN(max_chunk_size, (uint64_t)next_part_ofs - data_ofs);
     if (max_write_size > pending_data_bl.length()) {
@@ -3083,7 +3085,7 @@ int RGWRados::get_required_alignment(rgw_bucket& bucket, uint64_t *alignment)
 
 int RGWRados::get_max_chunk_size(rgw_bucket& bucket, uint64_t *max_chunk_size)
 {
-  uint64_t alignment;
+  uint64_t alignment = 0;
   int r = get_required_alignment(bucket, &alignment);
   if (r < 0) {
     return r;