lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 07 Jul 2010 15:07:26 +0200
From:	Jiri Slaby <jirislaby@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
CC:	avi@...hat.com, linux-kernel@...r.kernel.org,
	Marcelo Tosatti <mtosatti@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Gleb Natapov <gleb@...hat.com>,
	"Michael S. Tsirkin" <mst@...hat.com>,
	Gregory Haskins <ghaskins@...ell.com>, kvm@...r.kernel.org
Subject: Re: [PATCH] x86: KVM, fix lock imbalance

On 07/07/2010 03:05 PM, Ingo Molnar wrote:
> 
> * Jiri Slaby <jirislaby@...il.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@...il.com>
>> Cc: Avi Kivity <avi@...hat.com>
>> Cc: Marcelo Tosatti <mtosatti@...hat.com>
>> Cc: Thomas Gleixner <tglx@...utronix.de>
>> Cc: Ingo Molnar <mingo@...hat.com>
>> Cc: "H. Peter Anvin" <hpa@...or.com>
>> Cc: x86@...nel.org
>> Cc: Gleb Natapov <gleb@...hat.com>
>> Cc: "Michael S. Tsirkin" <mst@...hat.com>
>> Cc: Gregory Haskins <ghaskins@...ell.com>
>> Cc: kvm@...r.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ