79c4324644
Change-Id: I2d302dda68298877c65c99147f5bf22186a59aac
55 lines
2.0 KiB
Diff
55 lines
2.0 KiB
Diff
From 33dfb9d81a8cfe17aaa3f0804cbd491b06d38cd6 Mon Sep 17 00:00:00 2001
|
|
From: qihao <qihao_yewu@cmss.chinamobile.com>
|
|
Date: Tue, 27 Jun 2023 14:40:13 +0800
|
|
Subject: [PATCH] block/monitor: Fix crash when executing HMP commit
|
|
|
|
cheery-pick from b7b814cd87a5fbe9f0fb5732dd28932699317bda
|
|
|
|
hmp_commit() calls blk_is_available() from a non-coroutine context (and
|
|
in the main loop). blk_is_available() is a co_wrapper_mixed_bdrv_rdlock
|
|
function, and in the non-coroutine context it calls AIO_WAIT_WHILE(),
|
|
which crashes if the aio_context lock is not taken before.
|
|
|
|
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1615
|
|
Signed-off-by: Wang Liang <wangliangzz@inspur.com>
|
|
Message-Id: <20230424103902.45265-1-wangliangzz@126.com>
|
|
Reviewed-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>
|
|
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
(cherry picked from commit 8c1e8fb2e7fc2cbeb57703e143965a4cd3ad301a)
|
|
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
|
|
Signed-off-by: qihao_yewu <qihao_yewu@cmss.chinamobile.com>
|
|
---
|
|
block/monitor/block-hmp-cmds.c | 10 ++++++----
|
|
1 file changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/block/monitor/block-hmp-cmds.c b/block/monitor/block-hmp-cmds.c
|
|
index 2ac4aedfff..44f0af3430 100644
|
|
--- a/block/monitor/block-hmp-cmds.c
|
|
+++ b/block/monitor/block-hmp-cmds.c
|
|
@@ -213,15 +213,17 @@ void hmp_commit(Monitor *mon, const QDict *qdict)
|
|
error_report("Device '%s' not found", device);
|
|
return;
|
|
}
|
|
- if (!blk_is_available(blk)) {
|
|
- error_report("Device '%s' has no medium", device);
|
|
- return;
|
|
- }
|
|
|
|
bs = bdrv_skip_implicit_filters(blk_bs(blk));
|
|
aio_context = bdrv_get_aio_context(bs);
|
|
aio_context_acquire(aio_context);
|
|
|
|
+ if (!blk_is_available(blk)) {
|
|
+ error_report("Device '%s' has no medium", device);
|
|
+ aio_context_release(aio_context);
|
|
+ return;
|
|
+ }
|
|
+
|
|
ret = bdrv_commit(bs);
|
|
|
|
aio_context_release(aio_context);
|
|
--
|
|
2.41.0.windows.1
|
|
|