From dfb7ea99cf14405dae95b07374054dea6e34fa2a Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Wed, 29 Feb 2012 12:39:19 +0100 Subject: [PATCH 04/35] usb-redir: Don't try to write to the chardev after a close event RH-Author: Gerd Hoffmann Message-id: <1330519171-24231-5-git-send-email-kraxel@redhat.com> Patchwork-id: 37761 O-Subject: [RHEL-6.3 qemu-kvm PATCH v2 04/16] usb-redir: Don't try to write to the chardev after a close event Bugzilla: 758104 RH-Acked-by: Paolo Bonzini RH-Acked-by: Markus Armbruster RH-Acked-by: Alex Williamson 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 Signed-off-by: Anthony Liguori (cherry picked from commit c1b71a1df682fc49f91218130b1837d6d91dcb57) Conflicts: usb-redir.c --- usb-redir.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) Signed-off-by: Michal Novotny --- usb-redir.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/usb-redir.c b/usb-redir.c index 34c34d4..a9d048c 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_write(dev->cs, data, count); } -- 1.7.7.6