From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755534Ab0GGNGJ (ORCPT ); Wed, 7 Jul 2010 09:06:09 -0400 Received: from mx2.mail.elte.hu ([157.181.151.9]:56584 "EHLO mx2.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755006Ab0GGNGG (ORCPT ); Wed, 7 Jul 2010 09:06:06 -0400 Date: Wed, 7 Jul 2010 15:05:45 +0200 From: Ingo Molnar To: Jiri Slaby Cc: avi@redhat.com, linux-kernel@vger.kernel.org, Marcelo Tosatti , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Gleb Natapov , "Michael S. Tsirkin" , Gregory Haskins , kvm@vger.kernel.org Subject: Re: [PATCH] x86: KVM, fix lock imbalance Message-ID: <20100707130545.GA14934@elte.hu> References: <1278507745-32746-1-git-send-email-jirislaby@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1278507745-32746-1-git-send-email-jirislaby@gmail.com> User-Agent: Mutt/1.5.20 (2009-08-17) X-ELTE-SpamScore: -2.0 X-ELTE-SpamLevel: X-ELTE-SpamCheck: no X-ELTE-SpamVersion: ELTE 2.0 X-ELTE-SpamCheck-Details: score=-2.0 required=5.9 tests=BAYES_00 autolearn=no SpamAssassin version=3.2.5 -2.0 BAYES_00 BODY: Bayesian spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Jiri Slaby 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 > Cc: Avi Kivity > Cc: Marcelo Tosatti > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: x86@kernel.org > Cc: Gleb Natapov > Cc: "Michael S. Tsirkin" > Cc: Gregory Haskins > 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