kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
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, 07 Jul 2010 15:07:26 +0200	[thread overview]
Message-ID: <4C347C0E.6020107@gmail.com> (raw)
In-Reply-To: <20100707130545.GA14934@elte.hu>

On 07/07/2010 03:05 PM, Ingo Molnar wrote:
> 
> * 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.

Because the lock is around a block only. I usually don't create a goto
fail-paths in these cases. Do you want one?

thanks,
-- 
js

  reply	other threads:[~2010-07-07 13:07 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
2010-07-07 13:07   ` Jiri Slaby [this message]
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=4C347C0E.6020107@gmail.com \
    --to=jirislaby@gmail.com \
    --cc=avi@redhat.com \
    --cc=ghaskins@novell.com \
    --cc=gleb@redhat.com \
    --cc=hpa@zytor.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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 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).