]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/io: ensure ImageDispatchSpec cannot re-use AioCompletion 37714/head
authorJason Dillaman <dillaman@redhat.com>
Mon, 26 Oct 2020 12:27:46 +0000 (08:27 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 26 Oct 2020 16:01:12 +0000 (12:01 -0400)
Prevent re-using the same AioCompletion between multiple
ImageDispatchSpec objects to prevent the possibility of a memory
leak.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/io/ImageDispatchSpec.h

index 4b62c356ed05630c97f235ff057339644f1272e6..ee95f21be63f75cfce67eb529afcddf8501220b5 100644 (file)
@@ -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();
   }