From c1cfbb831ed0f3b9c4fd0007e78b5608a0e2a954 Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 7 Sep 2018 16:13:27 -0400 Subject: [PATCH] rgw: RGWAsyncGetBucketInstanceInfo does not access coroutine memory Fixes: http://tracker.ceph.com/issues/35812 Signed-off-by: Casey Bodley (cherry picked from commit 6fb61c5ed8eb7cbe6d1271a8b61e465023d2e621) --- src/rgw/rgw_cr_rados.cc | 2 +- src/rgw/rgw_cr_rados.h | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rgw/rgw_cr_rados.cc b/src/rgw/rgw_cr_rados.cc index a11b6466c5d6..d79188a8d446 100644 --- a/src/rgw/rgw_cr_rados.cc +++ b/src/rgw/rgw_cr_rados.cc @@ -498,7 +498,7 @@ bool RGWOmapAppend::finish() { int RGWAsyncGetBucketInstanceInfo::_send_request() { RGWObjectCtx obj_ctx(store); - int r = store->get_bucket_instance_from_oid(obj_ctx, oid, *bucket_info, NULL, NULL); + int r = store->get_bucket_instance_from_oid(obj_ctx, oid, bucket_info, NULL, NULL); if (r < 0) { ldout(store->ctx(), 0) << "ERROR: failed to get bucket instance info for " << oid << dendl; diff --git a/src/rgw/rgw_cr_rados.h b/src/rgw/rgw_cr_rados.h index b18f35b5220b..42828d4119f0 100644 --- a/src/rgw/rgw_cr_rados.h +++ b/src/rgw/rgw_cr_rados.h @@ -654,16 +654,15 @@ public: class RGWAsyncGetBucketInstanceInfo : public RGWAsyncRadosRequest { RGWRados *store; const std::string oid; - RGWBucketInfo *bucket_info; protected: int _send_request() override; public: RGWAsyncGetBucketInstanceInfo(RGWCoroutine *caller, RGWAioCompletionNotifier *cn, - RGWRados *_store, const std::string& oid, - RGWBucketInfo *_bucket_info) - : RGWAsyncRadosRequest(caller, cn), store(_store), - oid(oid), bucket_info(_bucket_info) {} + RGWRados *_store, const std::string& oid) + : RGWAsyncRadosRequest(caller, cn), store(_store), oid(oid) {} + + RGWBucketInfo bucket_info; }; class RGWGetBucketInstanceInfoCR : public RGWSimpleCoroutine { @@ -698,11 +697,14 @@ public: } int send_request() override { - req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, oid, bucket_info); + req = new RGWAsyncGetBucketInstanceInfo(this, stack->create_completion_notifier(), store, oid); async_rados->queue(req); return 0; } int request_complete() override { + if (bucket_info) { + *bucket_info = std::move(req->bucket_info); + } return req->get_ret_status(); } }; -- 2.47.3