]> xenbits.xensource.com Git - libvirt.git/commitdiff
virNetDevMacVLanCreateWithVPortProfile: Don't mask virNetDevMacVLanTapOpen error
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 9 Aug 2016 16:47:49 +0000 (18:47 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Wed, 10 Aug 2016 14:54:41 +0000 (16:54 +0200)
https://bugzilla.redhat.com/show_bug.cgi?id=1240439

In this function we create a macvtap device and open its tap
device. Possibly multiple times. Now the thing is, if opening the
tap device fails, that is virNetDevMacVLanTapOpen() returns a
negative value, we unroll all the changes BUT return 0 fooling
caller into thinking everything went okay.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
src/util/virnetdevmacvlan.c

index c05c67f34873b005b2934eb79ba9b4303496801d..88a0f94859a7fcd4a5d1db74720a153d6df1f0e2 100644 (file)
@@ -1120,8 +1120,10 @@ virNetDevMacVLanCreateWithVPortProfile(const char *ifnameRequested,
     }
 
     if (flags & VIR_NETDEV_MACVLAN_CREATE_WITH_TAP) {
-        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0)
+        if (virNetDevMacVLanTapOpen(ifnameCreated, tapfd, tapfdSize, 10) < 0) {
+            rc = -1;
             goto disassociate_exit;
+        }
 
         if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, vnet_hdr) < 0) {
             VIR_FORCE_CLOSE(rc); /* sets rc to -1 */