From baf55e1fa41a6aa77a5373891d70947ef24acadd Mon Sep 17 00:00:00 2001 From: Peter Krempa Date: Mon, 9 Nov 2015 13:44:29 +0100 Subject: [PATCH] qemu: hotplug: Reject VFIO hotplug if setting RLIMIT_MEMLOCK fails 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 b02e9050f2..13a4b300fd 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.39.5