]> git.proxmox.com Git - mirror_qemu.git/commit
hw/usb: fix mistaken de-initialization of CCID state
authorDaniel P. Berrangé <berrange@redhat.com>
Fri, 21 Dec 2018 13:41:15 +0000 (13:41 +0000)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 7 Jan 2019 13:12:20 +0000 (14:12 +0100)
commit3fd2092fd11b9e4220a08eca0663cc59178a6c3f
tree1246055b0537deb1410eaa6bc362d6c68bc7331e
parente59dbbac0364344a3ad84c3497a98c56003d3fb8
hw/usb: fix mistaken de-initialization of CCID state

In previous commit:

  commit 7dea29e4af17fc1d27478de9f8ea38144deac54a
  Author: Li Qiang <liq3ea@gmail.com>
  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 <mjt@tls.msk.ru>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20181221134115.27973-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/ccid-card-emulated.c