]> git.ipfire.org Git - thirdparty/qemu.git/commit
block/qed: fix use-after-free by nullifying timer pointer after free
authorDenis Rastyogin <gerben@altlinux.org>
Tue, 4 Mar 2025 08:39:10 +0000 (11:39 +0300)
committerMichael Tokarev <mjt@tls.msk.ru>
Sat, 22 Mar 2025 07:52:51 +0000 (10:52 +0300)
commit9f1e501fb1cb83b46f49df8bb2fb0950ea5fa5a5
tree25d4932a587d85831f8679127a5fa9cab8d3da84
parent57bc5203dd64070db5ff010d4ae05def9d7d7103
block/qed: fix use-after-free by nullifying timer pointer after free

This error was discovered by fuzzing qemu-img.

In the QED block driver, the need_check_timer timer is freed in
bdrv_qed_detach_aio_context, but the pointer to the timer is not
set to NULL. This can lead to a use-after-free scenario
in bdrv_qed_drain_begin().

The need_check_timer pointer is set to NULL after freeing the timer.
Which helps catch this condition when checking in bdrv_qed_drain_begin().

Closes: https://gitlab.com/qemu-project/qemu/-/issues/2852
Signed-off-by: Denis Rastyogin <gerben@altlinux.org>
Message-ID: <20250304083927.37681-1-gerben@altlinux.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit 2ad638a3d160923ef3dbf87c73944e6e44bdc724)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
block/qed.c