[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-8.0.5 27/43] block-migration: Ensure we don't crash during migra
From: |
Michael Tokarev |
Subject: |
[Stable-8.0.5 27/43] block-migration: Ensure we don't crash during migration cleanup |
Date: |
Sat, 9 Sep 2023 15:59:53 +0300 |
From: Fabiano Rosas <farosas@suse.de>
We can fail the blk_insert_bs() at init_blk_migration(), leaving the
BlkMigDevState without a dirty_bitmap and BlockDriverState. Account
for the possibly missing elements when doing cleanup.
Fix the following crashes:
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at
../block/dirty-bitmap.c:359
359 BlockDriverState *bs = bitmap->bs;
#0 0x0000555555ec83ef in bdrv_release_dirty_bitmap (bitmap=0x0) at
../block/dirty-bitmap.c:359
#1 0x0000555555bba331 in unset_dirty_tracking () at ../migration/block.c:371
#2 0x0000555555bbad98 in block_migration_cleanup_bmds () at
../migration/block.c:681
Thread 1 "qemu-system-x86" received signal SIGSEGV, Segmentation fault.
0x0000555555e971ff in bdrv_op_unblock (bs=0x0, op=BLOCK_OP_TYPE_BACKUP_SOURCE,
reason=0x0) at ../block.c:7073
7073 QLIST_FOREACH_SAFE(blocker, &bs->op_blockers[op], list, next) {
#0 0x0000555555e971ff in bdrv_op_unblock (bs=0x0,
op=BLOCK_OP_TYPE_BACKUP_SOURCE, reason=0x0) at ../block.c:7073
#1 0x0000555555e9734a in bdrv_op_unblock_all (bs=0x0, reason=0x0) at
../block.c:7095
#2 0x0000555555bbae13 in block_migration_cleanup_bmds () at
../migration/block.c:690
Signed-off-by: Fabiano Rosas <farosas@suse.de>
Message-id: 20230731203338.27581-1-farosas@suse.de
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
(cherry picked from commit f187609f27b261702a17f79d20bf252ee0d4f9cd)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/migration/block.c b/migration/block.c
index b2497bbd32..ece746e788 100644
--- a/migration/block.c
+++ b/migration/block.c
@@ -366,7 +366,9 @@ static void unset_dirty_tracking(void)
BlkMigDevState *bmds;
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
- bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+ if (bmds->dirty_bitmap) {
+ bdrv_release_dirty_bitmap(bmds->dirty_bitmap);
+ }
}
}
@@ -674,13 +676,18 @@ static int64_t get_remaining_dirty(void)
static void block_migration_cleanup_bmds(void)
{
BlkMigDevState *bmds;
+ BlockDriverState *bs;
AioContext *ctx;
unset_dirty_tracking();
while ((bmds = QSIMPLEQ_FIRST(&block_mig_state.bmds_list)) != NULL) {
QSIMPLEQ_REMOVE_HEAD(&block_mig_state.bmds_list, entry);
- bdrv_op_unblock_all(blk_bs(bmds->blk), bmds->blocker);
+
+ bs = blk_bs(bmds->blk);
+ if (bs) {
+ bdrv_op_unblock_all(bs, bmds->blocker);
+ }
error_free(bmds->blocker);
/* Save ctx, because bmds->blk can disappear during blk_unref. */
--
2.39.2
- [Stable-8.0.5 19/43] target/s390x: Fix VSTL with a large length, (continued)
- [Stable-8.0.5 19/43] target/s390x: Fix VSTL with a large length, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 20/43] target/s390x: Check reserved bits of VFMIN/VFMAX's M5, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 17/43] target/s390x: Fix the "ignored match" case in VSTRS, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 18/43] target/s390x: Use a 16-bit immediate in VREP, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 21/43] include/hw/virtio/virtio-gpu: Fix virtio-gpu with blob on big endian hosts, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 22/43] kvm: Introduce kvm_arch_get_default_type hook, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 23/43] accel/kvm: Specify default IPA size for arm64, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 24/43] target/arm: Fix SME ST1Q, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 25/43] target/arm: Fix 64-bit SSRA, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 26/43] docs/about/license: Update LICENSE URL, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 27/43] block-migration: Ensure we don't crash during migration cleanup,
Michael Tokarev <=
- [Stable-8.0.5 28/43] hw/ppc/e500: fix broken snapshot replay, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 29/43] ppc/vof: Fix missed fields in VOF cleanup, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 30/43] target/ppc: Flush inputs to zero with NJ in ppc_store_vscr, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 31/43] hw/ide/core: set ERR_STAT in unsupported command completion, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 32/43] hw/ide/ahci: write D2H FIS when processing NCQ command, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 33/43] hw/ide/ahci: simplify and document PxCI handling, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 34/43] hw/ide/ahci: PxSACT and PxCI is cleared when PxCMD.ST is cleared, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 35/43] hw/ide/ahci: PxCI should not get cleared when ERR_STAT is set, Michael Tokarev, 2023/09/09
- [Stable-8.0.5 36/43] hw/ide/ahci: fix ahci_write_fis_sdb(), Michael Tokarev, 2023/09/09
- [Stable-8.0.5 37/43] hw/ide/ahci: fix broken SError handling, Michael Tokarev, 2023/09/09