提交 820a2159 编写于 作者: E Eric Blake

qemu: fix use-after-free regression

Commit baade4d fixed a memory leak on failure, but in the process,
introduced a use-after-free on success, which can be triggered with:

1. set bandwidth with --live
2. query bandwidth
3. set bandwidth with --live

* src/qemu/qemu_driver.c (qemuDomainSetInterfaceParameters): Don't
free newBandwidth on success.
Reported by Hu Tao.
上级 302fe95f
...@@ -8034,6 +8034,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, ...@@ -8034,6 +8034,7 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
virNetDevBandwidthFree(net->bandwidth); virNetDevBandwidthFree(net->bandwidth);
net->bandwidth = newBandwidth; net->bandwidth = newBandwidth;
newBandwidth = NULL;
} }
if (flags & VIR_DOMAIN_AFFECT_CONFIG) { if (flags & VIR_DOMAIN_AFFECT_CONFIG) {
if (!persistentNet->bandwidth) { if (!persistentNet->bandwidth) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册