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

[libvirt] [PATCH] util: Prevent libvirtd crash



* src/util/virnetdevopenvswitch.c (virNetDevOpenvswitchAddPort): avoid libvirtd
crash due to derefing a NULL virtVlan->tag.

RHBZ: https://bugzilla.redhat.com/show_bug.cgi?id=852383

Signed-off-by: Alex Jia <ajia redhat com>
---
 src/util/virnetdevopenvswitch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/util/virnetdevopenvswitch.c b/src/util/virnetdevopenvswitch.c
index 601d79e..7d38ff8 100644
--- a/src/util/virnetdevopenvswitch.c
+++ b/src/util/virnetdevopenvswitch.c
@@ -100,7 +100,8 @@ int virNetDevOpenvswitchAddPort(const char *brname, const char *ifname,
                 virBufferAsprintf(buf, "%d", virtVlan->tag[i]);
             }
         } else {
-            virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]);
+            if (virtVlan->nTags)
+                virBufferAsprintf(buf, "tag=%d", virtVlan->tag[0]);
         }
     }
 
-- 
1.7.1


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