]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
librbd: clear ctx before initiating close in Image::{aio_,}close() 61526/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 22 Jan 2025 19:34:11 +0000 (20:34 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Sun, 26 Jan 2025 10:17:28 +0000 (11:17 +0100)
commit575392c944b195e473efb837b5a8d24dc3090333
tree2e7bedc56af8531eda7f0dad44e2ed0ec68948d6
parente726e9f606cf93088ac3d0078a99a1d3b791c1a1
librbd: clear ctx before initiating close in Image::{aio_,}close()

Image::aio_close() must clear ctx before initiating close.  Otherwise
the provided callback may see a non-NULL ctx and attempt to close the
image again from Image destructor, leading to an invalid memory access
as ImageCtx and ImageState are both freed immediately after the image
is closed (i.e. before AioCompletion is completed and the callback is
executed).

The same adjustment is made to Image::close() just for consistency.

Fixes: https://tracker.ceph.com/issues/69619
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 61baa8793402d416289ff25535d6f9124da3cae9)
src/librbd/librbd.cc