Since we handle close async in a bh, do_write and thus write can get
called after receiving a close event. This patch adds a check to
the usb-redir write callback to not call qemu_chr_fe_write on a closed
backend.

Signed-off-by: Hans de Goede <hdego...@redhat.com>
---
 usb-redir.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/usb-redir.c b/usb-redir.c
index 24fdd31..fb91c92 100644
--- a/usb-redir.c
+++ b/usb-redir.c
@@ -225,6 +225,10 @@ static int usbredir_write(void *priv, uint8_t *data, int 
count)
 {
     USBRedirDevice *dev = priv;
 
+    if (!dev->cs->opened) {
+        return 0;
+    }
+
     return qemu_chr_fe_write(dev->cs, data, count);
 }
 
-- 
1.7.7.3


Reply via email to