]> xenbits.xensource.com Git - libvirt.git/commitdiff
selinux: fix wrong tapfd relablling
authorGuannan Ren <gren@redhat.com>
Wed, 17 Oct 2012 03:23:19 +0000 (11:23 +0800)
committerGuannan Ren <gren@redhat.com>
Wed, 17 Oct 2012 05:13:14 +0000 (13:13 +0800)
It should relabel tapfd of virtual network of type VIR_DOMAIN_NET_TYPE_DIRECT
rather than VIR_DOMAIN_NET_TYPE_NETWORK and VIR_DOMAIN_NET_TYPE_BRIDGE
(commit ae368ebfcc4923d0b32e83d4ca96a6f599625785 introduced this bug)

Caution: The context of the two hunks is identical other than indentation.
Please be extremely cautious of where the patch gets applied.

src/qemu/qemu_command.c

index 239592ca1914c585baec10345df00adb7c71c40b..0c0c40068d910b4476b9c6250366d6de08f165f1 100644 (file)
@@ -5412,10 +5412,6 @@ qemuBuildCommandLine(virConnectPtr conn,
                     if (tapfd < 0)
                         goto error;
 
-                if (virSecurityManagerSetTapFDLabel(driver->securityManager,
-                                                    def, tapfd) < 0)
-                    goto error;
-
                     last_good_net = i;
                     virCommandTransferFD(cmd, tapfd);
 
@@ -5429,6 +5425,10 @@ qemuBuildCommandLine(virConnectPtr conn,
                 if (tapfd < 0)
                     goto error;
 
+                if (virSecurityManagerSetTapFDLabel(driver->securityManager,
+                                                    def, tapfd) < 0)
+                    goto error;
+
                 last_good_net = i;
                 virCommandTransferFD(cmd, tapfd);