]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: avoid empty object names 7709/head
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 19 Feb 2016 07:50:06 +0000 (23:50 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 19 Feb 2016 07:50:06 +0000 (23:50 -0800)
Don't try to sync an object with empty name (shouldn't happen, but
bugs may happen). Also, don't try to write_meta() of an empty object
name, in case we get there through a different path somehow.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_rados.cc

index 5d8c72f21e54d68be6a564aec55d5539e5764efd..5024820eb751af6d9873dd55fd70305b505e1619 100644 (file)
@@ -1834,6 +1834,12 @@ public:
       do {
         yield {
           marker_tracker->reset_need_retry(key);
+          if (key.name.empty()) {
+            /* shouldn't happen */
+            set_status("skipping empty entry");
+            ldout(sync_env->cct, 0) << "ERROR: " << __func__ << "(): entry with empty obj name, skipping" << dendl;
+            goto done;
+          }
           if (op == CLS_RGW_OP_ADD ||
               op == CLS_RGW_OP_LINK_OLH) {
             if (op == CLS_RGW_OP_ADD && !key.instance.empty() && key.instance != "null") {
index a54757bce4d5cb8a593b332e8d74a9e3ada81e33..b9d344ef3239ff166e11b0afc7b796a145d70284 100644 (file)
@@ -5659,6 +5659,12 @@ int RGWRados::Object::Write::write_meta(uint64_t size,
     return r;
 
   rgw_obj& obj = target->get_obj();
+
+  if (obj.get_object().empty()) {
+    ldout(store->ctx(), 0) << "ERROR: " << __func__ << "(): cannot write object with empty name" << dendl;
+    return -EIO;
+  }
+
   r = store->get_obj_ref(obj, &ref, &bucket);
   if (r < 0)
     return r;