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 | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 1e7a653..1a0d1e9 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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:
-- 
2.6.2

--
libvir-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to