[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 1/5] hw/usb: fix mistaken de-initialization of CCID s
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PULL 1/5] hw/usb: fix mistaken de-initialization of CCID state |
Date: |
Tue, 8 Jan 2019 16:53:50 +0100 |
From: Daniel P. Berrangé <address@hidden>
In previous commit:
commit 7dea29e4af17fc1d27478de9f8ea38144deac54a
Author: Li Qiang <address@hidden>
Date: Fri Oct 19 03:50:36 2018 -0700
hw: ccid-card-emulated: cleanup resource when realize in error path
The emulated_realize method was changed so that it jumps to a cleanup
label to de-initialize state upon error. This change failed to ensure
the success path exited the method before this point though. So the
mutexes are always destroyed even in normal operation. The result is
as crashtastic as expected:
$ qemu-system-x86_64 -usb -device usb-ccid,id=ccid0 -device
ccid-card-emulated,backend=nss-emulated,id=smartcard0,bus=ccid0.0
qemu-system-x86_64: util/qemu-thread-posix.c:64: qemu_mutex_lock_impl:
Assertion `mutex->initialized' failed.
Aborted (core dumped)
Fixes: 7dea29e4af1
Reported-by: Michael Tokarev <address@hidden>
Signed-off-by: Daniel P. Berrangé <address@hidden>
Reviewed-by: Michael Tokarev <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
Message-id: address@hidden
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb/ccid-card-emulated.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c
index 25976ed84f..e0457d305b 100644
--- a/hw/usb/ccid-card-emulated.c
+++ b/hw/usb/ccid-card-emulated.c
@@ -549,6 +549,8 @@ static void emulated_realize(CCIDCardState *base, Error
**errp)
qemu_thread_create(&card->apdu_thread_id, "ccid/apdu", handle_apdu_thread,
card, QEMU_THREAD_JOINABLE);
+ return;
+
out2:
clean_event_notifier(card);
out1:
--
2.9.3
- [Qemu-devel] [PULL 0/5] Usb 20190108 patches, Gerd Hoffmann, 2019/01/08
- [Qemu-devel] [PULL 3/5] usb: dev-mtp: fix memory leak in error path, Gerd Hoffmann, 2019/01/08
- [Qemu-devel] [PULL 4/5] hw/usb: Add generic sys-bus EHCI controller, Gerd Hoffmann, 2019/01/08
- [Qemu-devel] [PULL 1/5] hw/usb: fix mistaken de-initialization of CCID state,
Gerd Hoffmann <=
- [Qemu-devel] [PULL 2/5] usb: drop unnecessary usb_device_post_load checks, Gerd Hoffmann, 2019/01/08
- [Qemu-devel] [PULL 5/5] usb: move ehci_create_ich9_with_companions to hw/i386, Gerd Hoffmann, 2019/01/08
- Re: [Qemu-devel] [PULL 0/5] Usb 20190108 patches, Peter Maydell, 2019/01/08