From: Enming Zhang Date: Thu, 16 Nov 2017 05:35:32 +0000 (+0800) Subject: rgw: check read_op.read return value in RGWRados::copy_obj_data X-Git-Tag: v13.0.1~90^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4c641cfc5db070b3cfb4c747a5a21068132de2f6;p=ceph-ci.git rgw: check read_op.read return value in RGWRados::copy_obj_data The return-value-type of RGWRados::Object::Read::read is int, and the return value of RGWRados::Object::Read::read is either the length of object data which has been read if everything is OK, or the error value which is negative value if something is wrong. If an negative error value is assigned to read_len which is an unsigned long long type, the read_len will be a very large value, which will cause an error during RGWPutObjProcessor processing. Signed-off-by: Enming Zhang --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 060498c60be..5d32fab16a3 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -8229,6 +8229,10 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx, do { bufferlist bl; ret = read_op.read(ofs, end, bl); + if (ret < 0) { + ldout(cct, 0) << "ERROR: fail to read object data, ret = " << ret << dendl; + return ret; + } uint64_t read_len = ret; bool again;