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

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

 



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@xxxxxxxxxx>
---
 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]