[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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

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 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) {

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]