]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
librbd: clear ctx before initiating close in Image::{aio_,}close() 61527/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:18:20 +0000 (11:18 +0100)
commitaba7c2a54fb58dd71e7672394cd938c26f00ef36
treeb9ab39922b82ceb7330bbcf68b3ca836956d9873
parent845eb881a071a507dce55d47ffdc09978ea65983
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