dcavalca / rpms / qemu

Forked from rpms/qemu 11 months ago
Clone

Blame 0028-usb-redir-Don-t-try-to-write-to-the-chardev-after-a-.patch

Justin M. Forbes fc5c27
>From 7e49ff036892fade86c7734118ee0c6da5cbad09 Mon Sep 17 00:00:00 2001
Justin M. Forbes fc5c27
From: Hans de Goede <hdegoede@redhat.com>
Justin M. Forbes fc5c27
Date: Thu, 11 Aug 2011 12:11:16 +0200
Justin M. Forbes fc5c27
Subject: [PATCH 28/28] usb-redir: Don't try to write to the chardev after a
Justin M. Forbes fc5c27
 close event
Justin M. Forbes fc5c27
Justin M. Forbes fc5c27
Sicne we handle close async in a bh, do_write and thus write can get
Justin M. Forbes fc5c27
called after receiving a close event. This patch adds a check to
Justin M. Forbes fc5c27
the usb-redir write callback to not do a qemu_chr_write on a closed
Justin M. Forbes fc5c27
chardev.
Justin M. Forbes fc5c27
Justin M. Forbes fc5c27
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Justin M. Forbes fc5c27
---
Justin M. Forbes fc5c27
 usb-redir.c |    2 +-
Justin M. Forbes fc5c27
 1 files changed, 1 insertions(+), 1 deletions(-)
Justin M. Forbes fc5c27
Justin M. Forbes fc5c27
diff --git a/usb-redir.c b/usb-redir.c
Justin M. Forbes fc5c27
index 6d8f986..732ddab 100644
Justin M. Forbes fc5c27
--- a/usb-redir.c
Justin M. Forbes fc5c27
+++ b/usb-redir.c
Justin M. Forbes fc5c27
@@ -226,7 +226,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
Justin M. Forbes fc5c27
     USBRedirDevice *dev = priv;
Justin M. Forbes fc5c27
     int r;
Justin M. Forbes fc5c27
 
Justin M. Forbes fc5c27
-    if (dev->cs->write_blocked) {
Justin M. Forbes fc5c27
+    if (!dev->cs->opened || dev->cs->write_blocked) {
Justin M. Forbes fc5c27
         return 0;
Justin M. Forbes fc5c27
     }
Justin M. Forbes fc5c27
 
Justin M. Forbes fc5c27
-- 
Justin M. Forbes fc5c27
1.7.5.1
Justin M. Forbes fc5c27