]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: return ERANGE if set_chunk tries to set large range
authormyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 12:21:19 +0000 (21:21 +0900)
committermyoungwon oh <ohmyoungwon@gmail.com>
Tue, 18 Aug 2020 13:06:11 +0000 (22:06 +0900)
over the object size

We allow existing snapshot to be set as a chunk. So,
return ERAMGE if set_chunk's range is over the object
size

Signed-off-by: Myoungwon Oh <myoungwon.oh@samsumg.com>
src/osd/PrimaryLogPG.cc

index 18e7f2ca3ac9b9ebcfdb8c2eacd7ad412eb4466b..89a5b5716db962c3cd35e040964dad5f68498315 100644 (file)
@@ -7008,6 +7008,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
          result = -EINVAL;
          goto fail;
        }
+       if (src_offset + src_length > oi.size) {
+         result = -ERANGE;
+         goto fail;
+       }
 
        for (auto &p : oi.manifest.chunk_map) {
          if ((p.first <= src_offset && p.first + p.second.length > src_offset) ||