From: Jason Dillaman Date: Mon, 26 Oct 2020 12:27:46 +0000 (-0400) Subject: librbd/io: ensure ImageDispatchSpec cannot re-use AioCompletion X-Git-Tag: v16.1.0~752^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=32767bbfb5d6495fa50310685a550b0601cb275d;p=ceph.git librbd/io: ensure ImageDispatchSpec cannot re-use AioCompletion Prevent re-using the same AioCompletion between multiple ImageDispatchSpec objects to prevent the possibility of a memory leak. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/io/ImageDispatchSpec.h b/src/librbd/io/ImageDispatchSpec.h index 4b62c356ed05..ee95f21be63f 100644 --- a/src/librbd/io/ImageDispatchSpec.h +++ b/src/librbd/io/ImageDispatchSpec.h @@ -231,6 +231,7 @@ private: dispatch_layer(image_dispatch_layer), aio_comp(aio_comp), image_extents(std::move(image_extents)), request(std::move(request)), io_context(io_context), op_flags(op_flags), parent_trace(parent_trace) { + ceph_assert(aio_comp->image_dispatcher_ctx == nullptr); aio_comp->image_dispatcher_ctx = &dispatcher_ctx; aio_comp->get(); }