From 32767bbfb5d6495fa50310685a550b0601cb275d Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 26 Oct 2020 08:27:46 -0400 Subject: [PATCH] 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 --- src/librbd/io/ImageDispatchSpec.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/librbd/io/ImageDispatchSpec.h b/src/librbd/io/ImageDispatchSpec.h index 4b62c356ed056..ee95f21be63f7 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(); } -- 2.39.5