From: myoungwon oh Date: Tue, 18 Aug 2020 12:21:19 +0000 (+0900) Subject: osd: return ERANGE if set_chunk tries to set large range X-Git-Tag: v16.1.0~1248^2~32 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=287a2df6ad4b01d38601c34edfdfb12a3180b927;p=ceph.git osd: return ERANGE if set_chunk tries to set large range 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 --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 18e7f2ca3ac9..89a5b5716db9 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -7008,6 +7008,10 @@ int PrimaryLogPG::do_osd_ops(OpContext *ctx, vector& 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) ||