]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: clear ctx before initiating close in Image::{aio_,}close() 61492/head
authorIlya Dryomov <idryomov@gmail.com>
Wed, 22 Jan 2025 19:34:11 +0000 (20:34 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Wed, 22 Jan 2025 20:09:03 +0000 (21:09 +0100)
commit61baa8793402d416289ff25535d6f9124da3cae9
tree30449968864200fa47fb02828e1d8c92b5b47d72
parenta02b9b48d3ebfca07695eb7a1ac3ce403b7a685c
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>
src/librbd/librbd.cc