Device assignment command is like "-pcidevice host=xx:yy.z". Check bus:dev.func length to make sure its format is xx:yy.z. Signed-off-by: Weidong Han <weidong.han@xxxxxxxxx> --- qemu/hw/device-assignment.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/qemu/hw/device-assignment.c b/qemu/hw/device-assignment.c index cef7c8a..50a0d5c 100644 --- a/qemu/hw/device-assignment.c +++ b/qemu/hw/device-assignment.c @@ -1196,7 +1196,7 @@ out: AssignedDevInfo *add_assigned_device(const char *arg) { char *cp, *cp1; - char device[8]; + char device[9]; char dma[6]; int r; AssignedDevInfo *adev; @@ -1207,6 +1207,9 @@ AssignedDevInfo *add_assigned_device(const char *arg) return NULL; } r = get_param_value(device, sizeof(device), "host", arg); + /* b:d.f format: xx:yy.z */ + if (r != 7) + goto bad; r = get_param_value(adev->name, sizeof(adev->name), "name", arg); if (!r) snprintf(adev->name, sizeof(adev->name), "%s", device); -- 1.6.0.4
Attachment:
0002-kvm-qemu-check-device-assignment-command.patch
Description: 0002-kvm-qemu-check-device-assignment-command.patch