From c63a6ee79cbe45b8f8092543a110361a66d50ca9 Mon Sep 17 00:00:00 2001 From: Chunyan Liu Date: Thu, 7 Apr 2016 17:40:28 +0800 Subject: [PATCH] libxl: pvusb: Correctly check the controller type Missing a check of controller type. Signed-off-by: Chunyan Liu CC: Simon Cao CC: George Dunlap Reviewed-by: Juergen Gross Acked-by: Ian Jackson --- tools/libxl/libxl_pvusb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c index f0de36c572..d04cb93fad 100644 --- a/tools/libxl/libxl_pvusb.c +++ b/tools/libxl/libxl_pvusb.c @@ -862,6 +862,13 @@ static int libxl__device_usbdev_setdefault(libxl__gc *gc, } } + if (usbctrl->type != LIBXL_USBCTRL_TYPE_PV && + usbctrl->type != LIBXL_USBCTRL_TYPE_QUSB) { + LOG(ERROR, "Unsupported USB controller type"); + rc = ERROR_FAIL; + goto out; + } + rc = libxl__device_usbctrl_add_xenstore(gc, domid, usbctrl, update_json); if (rc) goto out; -- 2.30.2