[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.1.3 21/55] block: Fix locking in media change monitor commands
From: |
Michael Tokarev |
Subject: |
[Stable-8.1.3 21/55] block: Fix locking in media change monitor commands |
Date: |
Thu, 9 Nov 2023 16:42:25 +0300 |
From: Kevin Wolf <kwolf@redhat.com>
blk_insert_bs() requires that the caller holds the AioContext lock for
the node to be inserted. Since commit c066e808e11, neglecting to do so
causes a crash when the child has to be moved to a different AioContext
to attach it to the BlockBackend.
This fixes qmp_blockdev_insert_anon_medium(), which is called for the
QMP commands 'blockdev-insert-medium' and 'blockdev-change-medium', to
correctly take the lock.
Cc: qemu-stable@nongnu.org
Fixes: https://issues.redhat.com/browse/RHEL-3922
Fixes: c066e808e11a5c181b625537b6c78e0de27a4801
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-ID: <20231013153302.39234-2-kwolf@redhat.com>
Reviewed-by: Hanna Czenczek <hreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit fed824501501518b1ad3dc08a39f8f855508190d)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/block/qapi-sysemu.c b/block/qapi-sysemu.c
index ef07151892..305225db32 100644
--- a/block/qapi-sysemu.c
+++ b/block/qapi-sysemu.c
@@ -232,6 +232,7 @@ static void qmp_blockdev_insert_anon_medium(BlockBackend
*blk,
BlockDriverState *bs, Error **errp)
{
Error *local_err = NULL;
+ AioContext *ctx;
bool has_device;
int ret;
@@ -253,7 +254,11 @@ static void qmp_blockdev_insert_anon_medium(BlockBackend
*blk,
return;
}
+ ctx = bdrv_get_aio_context(bs);
+ aio_context_acquire(ctx);
ret = blk_insert_bs(blk, bs, errp);
+ aio_context_release(ctx);
+
if (ret < 0) {
return;
}
--
2.39.2
- [Stable-8.1.3 10/55] tracetool: avoid invalid escape in Python string, (continued)
- [Stable-8.1.3 10/55] tracetool: avoid invalid escape in Python string, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 05/55] tests/docker: avoid invalid escape in Python string, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 08/55] tests/avocado: avoid invalid escape in Python string, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 13/55] linux-user/sh4: Fix crashes on signal delivery, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 07/55] target/hexagon: avoid invalid escape in Python string, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 12/55] linux-user/mips: fix abort on integer overflow, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 11/55] linux-user: Fixes for zero_bss, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 14/55] lasips2: LASI PS/2 devices are not user-createable, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 15/55] target/arm: Fix CNTPCT_EL0 trapping from EL0 when HCR_EL2.E2H is 0, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 16/55] hw/sd/sdhci: Block Size Register bits [14:12] is lost, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 21/55] block: Fix locking in media change monitor commands,
Michael Tokarev <=
- [Stable-8.1.3 20/55] misc/led: LED state is set opposite of what is expected, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 17/55] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port(), Michael Tokarev, 2023/11/09
- [Stable-8.1.3 19/55] target/arm: Fix syndrome for FGT traps on ERET, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 18/55] target/sparc: Clear may_lookup for npc == DYNAMIC_PC, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 25/55] target/arm: Fix SVE STR increment, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 22/55] tests/tcg: Add -fno-stack-protector, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 23/55] qemu-img: rebase: stop when reaching EOF of old backing file, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 24/55] qemu-iotests: 024: add rebasing test case for overlay_size > backing_size, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 26/55] target/arm: Correctly propagate stage 1 BTI guarded bit in a two-stage walk, Michael Tokarev, 2023/11/09
- [Stable-8.1.3 28/55] vfio/pci: Fix buffer overrun when writing the VF token, Michael Tokarev, 2023/11/09