提交 2a702717 编写于 作者: P Peter Krempa 提交者: Eric Blake

qemu: Fix crash when updating media with shared device

Mimic the fix done in 02b90972 to fix crash by
accessing an already freed structure. Also copy the explaining comment why the
pointer can't be accessed any more.
(cherry picked from commit 43b6f304)
上级 5fdccc85
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册