* [PATCH] hw/core/qdev-properties-system: Add missing return in set_drive_helper()
@ 2025-05-23 6:53 Fiona Ebner
0 siblings, 0 replies; only message in thread
From: Fiona Ebner @ 2025-05-23 6:53 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-stable, eduardo, berrange, pbonzini, vsementsov
Currently, changing the drive property of e.g. a scsi-hd object will
result in an assertion failure:
> bdrv_replace_child_noperm: Assertion `bdrv_get_aio_context(old_bs) ==
> bdrv_get_aio_context(new_bs)' failed.
The problematic scenario is already detected, but a 'return' statement
was missing.
Cc: qemu-stable@nongnu.org
Fixes: d1a58c176a ("qdev: allow setting drive property for realized device")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
---
Reproducer:
#!/bin/bash
rm /tmp/disk0.raw
rm /tmp/disk1.raw
./qemu-img create -f raw /tmp/disk0.raw 1G
./qemu-img create -f raw /tmp/disk1.raw 1G
./qemu-system-x86_64 --qmp stdio \
--blockdev file,node-name=node0,filename=/tmp/disk0.raw \
--blockdev file,node-name=node1,filename=/tmp/disk1.raw \
--nodefaults \
--object 'iothread,id=iothread0' \
--device 'virtio-scsi-pci,id=virtioscsi0,bus=pci.0,addr=0x3,iothread=iothread0' \
--device 'scsi-hd,bus=virtioscsi0.0,scsi-id=1,drive=node0,id=scsi0' \
<<EOF
{"execute": "qmp_capabilities"}
{"execute": "qom-set", "arguments": { "path": "/machine/peripheral/scsi0", "property": "drive", "value": "node1" } }
{"execute": "quit"}
EOF
hw/core/qdev-properties-system.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c
index 8e11e6388b..24e145d870 100644
--- a/hw/core/qdev-properties-system.c
+++ b/hw/core/qdev-properties-system.c
@@ -145,6 +145,7 @@ static void set_drive_helper(Object *obj, Visitor *v, const char *name,
if (ctx != bdrv_get_aio_context(bs)) {
error_setg(errp, "Different aio context is not supported for new "
"node");
+ return;
}
blk_replace_bs(blk, bs, errp);
--
2.39.5
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-05-23 6:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-23 6:53 [PATCH] hw/core/qdev-properties-system: Add missing return in set_drive_helper() Fiona Ebner
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).