aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2012-02-26 16:14:44 +0100
committerGerd Hoffmann <kraxel@redhat.com>2012-02-27 13:37:37 +0100
commit5b3bd68244c87e161ea309ed380f216acf7cd754 (patch)
tree1529e073c7a25a276a3dee7dc3af3b43ae936e3a
parent52234bc00d5cf13cf96b3d632a4e0aa34cec08be (diff)
downloadqemu-5b3bd68244c87e161ea309ed380f216acf7cd754.zip
qemu-5b3bd68244c87e161ea309ed380f216acf7cd754.tar.gz
qemu-5b3bd68244c87e161ea309ed380f216acf7cd754.tar.bz2
usb-redir: Always clear device state on filter reject
Always call usbredir_device_disconnect() when usbredir_check_filter() fails to clean up all the device state (ie received endpoint info). Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
-rw-r--r--usb-redir.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/usb-redir.c b/usb-redir.c
index 18204be..c98b14e 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -958,7 +958,7 @@ static int usbredir_check_filter(USBRedirDevice *dev)
{
if (dev->interface_info.interface_count == 0) {
ERROR("No interface info for device\n");
- return -1;
+ goto error;
}
if (dev->filter_rules) {
@@ -966,7 +966,7 @@ static int usbredir_check_filter(USBRedirDevice *dev)
usb_redir_cap_connect_device_version)) {
ERROR("Device filter specified and peer does not have the "
"connect_device_version capability\n");
- return -1;
+ goto error;
}
if (usbredirfilter_check(
@@ -983,11 +983,15 @@ static int usbredir_check_filter(USBRedirDevice *dev)
dev->device_info.product_id,
dev->device_info.device_version_bcd,
0) != 0) {
- return -1;
+ goto error;
}
}
return 0;
+
+error:
+ usbredir_device_disconnect(dev);
+ return -1;
}
/*
@@ -1113,7 +1117,6 @@ static void usbredir_interface_info(void *priv,
if (usbredir_check_filter(dev)) {
ERROR("Device no longer matches filter after interface info "
"change, disconnecting!\n");
- usbredir_device_disconnect(dev);
}
}
}