|
|
43fe83 |
From ecfbbe86d4d700201e81c093be30c0933f453d18 Mon Sep 17 00:00:00 2001
|
|
|
43fe83 |
Message-Id: <ecfbbe86d4d700201e81c093be30c0933f453d18.1378475168.git.jdenemar@redhat.com>
|
|
|
43fe83 |
From: Peter Krempa <pkrempa@redhat.com>
|
|
|
43fe83 |
Date: Thu, 5 Sep 2013 10:06:38 +0200
|
|
|
43fe83 |
Subject: [PATCH] conf: Don't deref NULL actual network in
|
|
|
43fe83 |
virDomainNetGetActualHostdev()
|
|
|
43fe83 |
|
|
|
43fe83 |
https://bugzilla.redhat.com/show_bug.cgi?id=1003537
|
|
|
43fe83 |
|
|
|
43fe83 |
In commit 991270db99690 I've used virDomainNetGetActualHostdev() to get
|
|
|
43fe83 |
the actual hostdev from a network when removing the network from the
|
|
|
43fe83 |
list to avoid leaving the hostdev in the list. I didn't notice that this
|
|
|
43fe83 |
function doesn't check if the actual network is allocated and
|
|
|
43fe83 |
dereferences it. This crashes the daemon when cleaning up a domain
|
|
|
43fe83 |
object in early startup phases when the actual network definition isn't
|
|
|
43fe83 |
allocated. When the actual definition isn't present, the hostdev that
|
|
|
43fe83 |
might correspond to it won't be present anyways so it's safe to return
|
|
|
43fe83 |
NULL.
|
|
|
43fe83 |
|
|
|
43fe83 |
Thanks to Cole Robinson for noticing this problem.
|
|
|
43fe83 |
|
|
|
43fe83 |
(cherry picked from commit a3d24862df9d717b95fae3951019fa150a9d4e09)
|
|
|
43fe83 |
---
|
|
|
43fe83 |
src/conf/domain_conf.c | 1 +
|
|
|
43fe83 |
1 file changed, 1 insertion(+)
|
|
|
43fe83 |
|
|
|
43fe83 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
43fe83 |
index 7a80508..53daf73 100644
|
|
|
43fe83 |
--- a/src/conf/domain_conf.c
|
|
|
43fe83 |
+++ b/src/conf/domain_conf.c
|
|
|
43fe83 |
@@ -17799,6 +17799,7 @@ virDomainNetGetActualHostdev(virDomainNetDefPtr iface)
|
|
|
43fe83 |
if (iface->type == VIR_DOMAIN_NET_TYPE_HOSTDEV)
|
|
|
43fe83 |
return &iface->data.hostdev.def;
|
|
|
43fe83 |
if (iface->type == VIR_DOMAIN_NET_TYPE_NETWORK &&
|
|
|
43fe83 |
+ iface->data.network.actual &&
|
|
|
43fe83 |
iface->data.network.actual->type == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
|
|
|
43fe83 |
return &iface->data.network.actual->data.hostdev.def;
|
|
|
43fe83 |
}
|
|
|
43fe83 |
--
|
|
|
43fe83 |
1.8.3.2
|
|
|
43fe83 |
|