diff options
author | Hans de Goede <hdegoede@redhat.com> | 2011-11-19 10:22:47 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-11-28 16:20:51 -0600 |
commit | c1b71a1df682fc49f91218130b1837d6d91dcb57 (patch) | |
tree | cd243a07f86e22d4ea52d5a1045a8d0622a0ec14 /usb-redir.c | |
parent | 99f08100cd2b35a35e1c5b2e6b043911a568906c (diff) |
usb-redir: Don't try to write to the chardev after a close event
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 <hdegoede@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'usb-redir.c')
-rw-r--r-- | usb-redir.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/usb-redir.c b/usb-redir.c index 24fdd31ce5..fb91c926a9 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); } |