All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: avi@redhat.com, linux-kernel@vger.kernel.org,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
	x86@kernel.org, Gleb Natapov <gleb@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	Gregory Haskins <ghaskins@novell.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] x86: KVM, fix lock imbalance
Date: Wed, 7 Jul 2010 15:05:45 +0200	[thread overview]
Message-ID: <20100707130545.GA14934@elte.hu> (raw)
In-Reply-To: <1278507745-32746-1-git-send-email-jirislaby@gmail.com>


* Jiri Slaby <jirislaby@gmail.com> wrote:

> Stanse found that there is an omitted unlock in kvm_create_pit in one fail
> path. Add proper unlock there.
> 
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: "H. Peter Anvin" <hpa@zytor.com>
> Cc: x86@kernel.org
> Cc: Gleb Natapov <gleb@redhat.com>
> Cc: "Michael S. Tsirkin" <mst@redhat.com>
> Cc: Gregory Haskins <ghaskins@novell.com>
> Cc: kvm@vger.kernel.org
> ---
>  arch/x86/kvm/i8254.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
> index 467cc47..70db4d4 100644
> --- a/arch/x86/kvm/i8254.c
> +++ b/arch/x86/kvm/i8254.c
> @@ -696,6 +696,7 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
>  
>  	pit->wq = create_singlethread_workqueue("kvm-pit-wq");
>  	if (!pit->wq) {
> +		mutex_unlock(&pit->pit_state.lock);
>  		kfree(pit);
>  		return NULL;
>  	}

A cleanliness comment: why is that tear-down/dealloc sequence open-coded? It 
should be at the end of the function, with goto labels, like we do it in 
similar cases.

Thanks,

	Ingo

  reply	other threads:[~2010-07-07 13:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-07 13:02 [PATCH] x86: KVM, fix lock imbalance Jiri Slaby
2010-07-07 13:05 ` Ingo Molnar [this message]
2010-07-07 13:07   ` Jiri Slaby
2010-07-07 13:12     ` Jiri Slaby
2010-07-07 13:21     ` Avi Kivity
2010-07-07 14:10       ` Ingo Molnar
2010-07-07 14:14         ` Avi Kivity

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=20100707130545.GA14934@elte.hu \
    --to=mingo@elte.hu \
    --cc=avi@redhat.com \
    --cc=ghaskins@novell.com \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=jirislaby@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mst@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.