|
Hans de Goede |
1b1995 |
From 49a01afb24b925de97074d093fb072bb7de470f9 Mon Sep 17 00:00:00 2001
|
|
Hans de Goede |
1b1995 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
1b1995 |
Date: Sat, 18 Feb 2012 09:18:57 +0100
|
|
Hans de Goede |
1b1995 |
Subject: [PATCH 122/140] usb-redir: Always clear device state on filter
|
|
Hans de Goede |
1b1995 |
reject
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
Always call usbredir_device_disconnect() when usbredir_check_filter() fails
|
|
Hans de Goede |
1b1995 |
to clean up all the device state (ie received endpoint info).
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
Hans de Goede |
1b1995 |
---
|
|
Hans de Goede |
1b1995 |
usb-redir.c | 11 +++++++----
|
|
Hans de Goede |
1b1995 |
1 file changed, 7 insertions(+), 4 deletions(-)
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
diff --git a/usb-redir.c b/usb-redir.c
|
|
Hans de Goede |
1b1995 |
index 9b804e9..fe3b0a3 100644
|
|
Hans de Goede |
1b1995 |
--- a/usb-redir.c
|
|
Hans de Goede |
1b1995 |
+++ b/usb-redir.c
|
|
Hans de Goede |
1b1995 |
@@ -985,7 +985,7 @@ static int usbredir_check_filter(USBRedirDevice *dev)
|
|
Hans de Goede |
1b1995 |
{
|
|
Hans de Goede |
1b1995 |
if (dev->interface_info.interface_count == 0) {
|
|
Hans de Goede |
1b1995 |
ERROR("No interface info for device\n");
|
|
Hans de Goede |
1b1995 |
- return -1;
|
|
Hans de Goede |
1b1995 |
+ goto error;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
if (dev->filter_rules) {
|
|
Hans de Goede |
1b1995 |
@@ -993,7 +993,7 @@ static int usbredir_check_filter(USBRedirDevice *dev)
|
|
Hans de Goede |
1b1995 |
usb_redir_cap_connect_device_version)) {
|
|
Hans de Goede |
1b1995 |
ERROR("Device filter specified and peer does not have the "
|
|
Hans de Goede |
1b1995 |
"connect_device_version capability\n");
|
|
Hans de Goede |
1b1995 |
- return -1;
|
|
Hans de Goede |
1b1995 |
+ goto error;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
if (usbredirfilter_check(
|
|
Hans de Goede |
1b1995 |
@@ -1010,11 +1010,15 @@ static int usbredir_check_filter(USBRedirDevice *dev)
|
|
Hans de Goede |
1b1995 |
dev->device_info.product_id,
|
|
Hans de Goede |
1b1995 |
dev->device_info.device_version_bcd,
|
|
Hans de Goede |
1b1995 |
0) != 0) {
|
|
Hans de Goede |
1b1995 |
- return -1;
|
|
Hans de Goede |
1b1995 |
+ goto error;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
return 0;
|
|
Hans de Goede |
1b1995 |
+
|
|
Hans de Goede |
1b1995 |
+error:
|
|
Hans de Goede |
1b1995 |
+ usbredir_device_disconnect(dev);
|
|
Hans de Goede |
1b1995 |
+ return -1;
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
|
|
Hans de Goede |
1b1995 |
/*
|
|
Hans de Goede |
1b1995 |
@@ -1140,7 +1144,6 @@ static void usbredir_interface_info(void *priv,
|
|
Hans de Goede |
1b1995 |
if (usbredir_check_filter(dev)) {
|
|
Hans de Goede |
1b1995 |
ERROR("Device no longer matches filter after interface info "
|
|
Hans de Goede |
1b1995 |
"change, disconnecting!\n");
|
|
Hans de Goede |
1b1995 |
- usbredir_device_disconnect(dev);
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
}
|
|
Hans de Goede |
1b1995 |
--
|
|
Hans de Goede |
1b1995 |
1.7.9.3
|
|
Hans de Goede |
1b1995 |
|