qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] Block patches
@ 2025-03-06  2:21 Stefan Hajnoczi
  2025-03-06  2:21 ` [PULL 1/1] block/qed: fix use-after-free by nullifying timer pointer after free Stefan Hajnoczi
  2025-03-07  7:18 ` [PULL 0/1] Block patches Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-03-06  2:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf

The following changes since commit 661c2e1ab29cd9c4d268ae3f44712e8d421c0e56:

  scripts/checkpatch: Fix a typo (2025-03-04 09:30:26 +0800)

are available in the Git repository at:

  https://gitlab.com/stefanha/qemu.git tags/block-pull-request

for you to fetch changes up to 2ad638a3d160923ef3dbf87c73944e6e44bdc724:

  block/qed: fix use-after-free by nullifying timer pointer after free (2025-03-06 10:19:54 +0800)

----------------------------------------------------------------
Pull request

QED need_check_timer use-after-free fix

----------------------------------------------------------------

Denis Rastyogin (1):
  block/qed: fix use-after-free by nullifying timer pointer after free

 block/qed.c | 1 +
 1 file changed, 1 insertion(+)

-- 
2.48.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PULL 1/1] block/qed: fix use-after-free by nullifying timer pointer after free
  2025-03-06  2:21 [PULL 0/1] Block patches Stefan Hajnoczi
@ 2025-03-06  2:21 ` Stefan Hajnoczi
  2025-03-07  7:18 ` [PULL 0/1] Block patches Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-03-06  2:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf,
	Denis Rastyogin

From: Denis Rastyogin <gerben@altlinux.org>

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>
---
 block/qed.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/qed.c b/block/qed.c
index 382c9e5335..ac24449ffb 100644
--- a/block/qed.c
+++ b/block/qed.c
@@ -353,6 +353,7 @@ static void bdrv_qed_detach_aio_context(BlockDriverState *bs)
 
     qed_cancel_need_check_timer(s);
     timer_free(s->need_check_timer);
+    s->need_check_timer = NULL;
 }
 
 static void bdrv_qed_attach_aio_context(BlockDriverState *bs,
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PULL 0/1] Block patches
  2025-03-06  2:21 [PULL 0/1] Block patches Stefan Hajnoczi
  2025-03-06  2:21 ` [PULL 1/1] block/qed: fix use-after-free by nullifying timer pointer after free Stefan Hajnoczi
@ 2025-03-07  7:18 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2025-03-07  7:18 UTC (permalink / raw)
  To: Stefan Hajnoczi
  Cc: qemu-devel, qemu-block, Stefan Hajnoczi, Hanna Reitz, Kevin Wolf

[-- Attachment #1: Type: text/plain, Size: 116 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-07  7:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-06  2:21 [PULL 0/1] Block patches Stefan Hajnoczi
2025-03-06  2:21 ` [PULL 1/1] block/qed: fix use-after-free by nullifying timer pointer after free Stefan Hajnoczi
2025-03-07  7:18 ` [PULL 0/1] Block patches Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).