From 38e62918e03f7b26e56c3dbed2d2a71e39b497b8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Tue, 19 Nov 2013 10:23:32 +0100 Subject: usbredirhost: Fix a cancellation corner case Signed-off-by: Hans de Goede --- usbredirhost/usbredirhost.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usbredirhost/usbredirhost.c b/usbredirhost/usbredirhost.c index 86e1a92..47ee5e4 100644 --- a/usbredirhost/usbredirhost.c +++ b/usbredirhost/usbredirhost.c @@ -1912,7 +1912,9 @@ static void usbredirhost_cancel_data_packet(void *priv, uint64_t id) LOCK(host); for (t = host->transfers_head.next; t; t = t->next) { - if (t->id == id) { + /* After cancellation the guest may re-use the id, so skip already + cancelled packets */ + if (!t->cancelled && t->id == id) { break; } } -- cgit v1.2.3