On 4/10/19 11:49 PM, Daniel Henrique Barboza wrote:
Commit f1d6585300 ("domain_conf: check device address before attach") added an address verification for all devices, avoiding calling the driver attach() for a case in which we know that the device would have duplicated address. That commit failed to contemplate the case of CDROM/Floppy devices that can change and eject media using attach-device, an usage that is also covered by this command. This patch adds an extra condition for the added address verification code, allowing CDROM/Floppy devices to bypass it. Fixes: f1d6585300001c7b23b8796a0faa4411c3531996 Reported-by: Jim Fehlig <jfehlig@xxxxxxxx> Signed-off-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx> --- src/conf/domain_conf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b6be1e730d..f65a335d86 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28597,6 +28597,7 @@ virDomainDefCompatibleDevice(virDomainDefPtr def, if (action == VIR_DOMAIN_DEVICE_ACTION_ATTACH && data.newInfo && data.newInfo->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + !virDomainDiskIsCdromOrFloppy(dev->data.disk) &&
This is unsafe. You can't access dev->data.* unless you check dev->type because @data is a union.
I'm testing a different approach. Will post patches shortly. Michal -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list