[libvirt] [PATCH] network: fix crash when starting a network with no <pf> element

Martin Kletzander mkletzan at redhat.com
Thu Aug 14 21:10:40 UTC 2014


On Thu, Aug 14, 2014 at 12:40:07PM -0400, Laine Stump wrote:
>Martin Kletzander pointed out in email that my commit 2a193f64
>introduced a crash in networkCreateInterfacePool() during startup of
>any network that doesn't have a <pf> subelement of its <forward>
>element. He also supplied a patch.
>
> http://www.redhat.com/archives/libvir-list/2014-August/msg00655.html
>
>I expanded on that patch by
>cleaning uyp now-extraneous checks in the callers of

s/uyp/up/

>networkCreateInterfacePool().
>
>Fortunately the offending patch hasn't been in any release, and hasn't
>been (to my knowledge) backported to any other branch.
>---
> src/network/bridge_driver.c | 17 +++++++----------
> 1 file changed, 7 insertions(+), 10 deletions(-)
>
>diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
>index 1ba4c3d..fc4c73d 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.npfs || netdef->forward.nifs > 0)

I'd match these to use both !var (or var != 0), but other than that
the patch is fine, ACK with that fixed.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140814/5af8100a/attachment-0001.sig>


More information about the libvir-list mailing list