[libvirt] [PATCH] [RFC] net: don't segfault on Martin's setup

Martin Kletzander mkletzan at redhat.com
Thu Aug 14 14:13:13 UTC 2014


No, don't worry, this is not a real commit message, this is more like
an RFC about how to fix it.  I'm not sure about this part of libvirt
codebase, so I'm rather asking for help.  Apparently, I have a network
with netdef->forward.pfs == NULL, I suspect this is a network I have,
that doesn't have any <forward/> element.

With the following fix, everything works as expected, but I'm almost
certain this is not enough.

Signed-off-by: Martin Kletzander <mkletzan at redhat.com>
---
 src/network/bridge_driver.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 1ba4c3d..3a40124 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -2196,6 +2196,9 @@ networkCreateInterfacePool(virNetworkDefPtr netdef)
     int ret = -1;
     size_t i;

+    if (!netdef->forward.pfs)
+        return 0;
+
     if ((virNetDevGetVirtualFunctions(netdef->forward.pfs->dev,
                                       &vfNames, &virtFns, &numVirtFns)) < 0) {
         virReportError(VIR_ERR_INTERNAL_ERROR,
-- 
2.0.4




More information about the libvir-list mailing list