mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-28 11:21:44 +03:00
qemu: Fix crash when updating media with shared device
Mimic the fix done in 02b9097274
to fix crash by
accessing an already freed structure. Also copy the explaining comment why the
pointer can't be accessed any more.
This commit is contained in:
parent
deb86ee912
commit
43b6f304bc
@ -6073,14 +6073,17 @@ qemuDomainChangeDiskMediaLive(virDomainObjPtr vm,
|
||||
goto end;
|
||||
|
||||
ret = qemuDomainChangeEjectableMedia(driver, vm, disk, orig_disk, force);
|
||||
/* 'disk' must not be accessed now - it has been freed.
|
||||
* 'orig_disk' now points to the new disk, while 'dev_copy'
|
||||
* now points to the old disk */
|
||||
|
||||
/* Need to remove the shared disk entry for the original
|
||||
* disk src if the operation is either ejecting or updating.
|
||||
*/
|
||||
if (ret == 0) {
|
||||
dev->data.disk = NULL;
|
||||
/* Need to remove the shared disk entry for the original
|
||||
* disk src if the operation is either ejecting or updating.
|
||||
*/
|
||||
if (orig_disk->src && STRNEQ_NULLABLE(orig_disk->src, disk->src))
|
||||
ignore_value(qemuRemoveSharedDisk(driver, dev_copy->data.disk,
|
||||
vm->def->name));
|
||||
ignore_value(qemuRemoveSharedDisk(driver, dev_copy->data.disk,
|
||||
vm->def->name));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user