qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: "Daniel P. Berrangé" <berrange@redhat.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, Michael Tokarev <mjt@tls.msk.ru>,
	qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/usb: fix mistaken de-initialization of CCID state
Date: Fri, 21 Dec 2018 16:19:15 +0100	[thread overview]
Message-ID: <009f5d95-c968-6f3f-93c2-32300ee7e5e1@redhat.com> (raw)
In-Reply-To: <20181221134115.27973-1-berrange@redhat.com>

On 12/21/18 2:41 PM, Daniel P. Berrangé wrote:
> 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)
> 
> Reported-by: Michael Tokarev <mjt@tls.msk.ru>

Fixes: 7dea29e4af1

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  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:
> 

      parent reply	other threads:[~2018-12-21 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21 13:41 [Qemu-devel] [PATCH] hw/usb: fix mistaken de-initialization of CCID state Daniel P. Berrangé
2018-12-21 14:46 ` Michael Tokarev
2018-12-21 15:19 ` Philippe Mathieu-Daudé [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=009f5d95-c968-6f3f-93c2-32300ee7e5e1@redhat.com \
    --to=philmd@redhat.com \
    --cc=berrange@redhat.com \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).