]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK fails
authorPeter Krempa <pkrempa@redhat.com>
Mon, 9 Nov 2015 12:44:29 +0000 (13:44 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Tue, 10 Nov 2015 08:34:36 +0000 (09:34 +0100)
Check the return value of virCommandSetMaxMemLock when hotplugging VFIO
PCI hostdevs and reject the hotplug if the memory limit can't be set.

src/qemu/qemu_hotplug.c

index b02e9050f2d9a2c25e02a759ecbc4f02b9e744e3..13a4b300fdf9bd83b126c387f98d3f6c2b4432f8 100644 (file)
@@ -1279,7 +1279,10 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
         }
 
         /* setup memory locking limits, that are necessary for VFIO */
-        virProcessSetMaxMemLock(vm->pid, qemuDomainGetMlockLimitBytes(vm->def));
+        if (virProcessSetMaxMemLock(vm->pid,
+                                    qemuDomainGetMlockLimitBytes(vm->def)) < 0)
+            goto error;
+
         break;
 
     default: