From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752224AbbCEIGO (ORCPT ); Thu, 5 Mar 2015 03:06:14 -0500 Received: from mx5-phx2.redhat.com ([209.132.183.37]:44095 "EHLO mx5-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751617AbbCEIGN (ORCPT ); Thu, 5 Mar 2015 03:06:13 -0500 Date: Thu, 5 Mar 2015 03:06:08 -0500 (EST) From: Jason Wang To: Vitaly Kuznetsov Cc: "K. Y. Srinivasan" , devel@linuxdriverproject.org, Haiyang Zhang , linux-kernel@vger.kernel.org, Dexuan Cui Message-ID: <680331570.19311911.1425542768518.JavaMail.zimbra@redhat.com> In-Reply-To: <1424435367-26384-1-git-send-email-vkuznets@redhat.com> References: <1424435367-26384-1-git-send-email-vkuznets@redhat.com> Subject: Re: [PATCH] Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.5.82.6] X-Mailer: Zimbra 8.0.6_GA_5922 (ZimbraWebClient - GC40 (Linux)/8.0.6_GA_5922) Thread-Topic: Drivers: hv: hv_balloon: keep locks balanced on add_memory() failure Thread-Index: liqwOswRdvALBRm6llQUIM1Pa0BvCg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- Original Message ----- > When add_memory() fails the following BUG is observed: > [ 743.646107] hv_balloon: hot_add memory failed error is -17 > [ 743.679973] > [ 743.680930] ===================================== > [ 743.680930] [ BUG: bad unlock balance detected! ] > [ 743.680930] 3.19.0-rc5_bug1131426+ #552 Not tainted > [ 743.680930] ------------------------------------- > [ 743.680930] kworker/0:2/255 is trying to release lock > (&dm_device.ha_region_mutex) at: > [ 743.680930] [] mutex_unlock+0xe/0x10 > [ 743.680930] but there are no more locks to release! > > This happens as we don't acquire ha_region_mutex and hot_add_req() expects us > to as it does unconditional mutex_unlock(). Acquire the lock on the error > path. > > Signed-off-by: Vitaly Kuznetsov Acked-by: Jason Wang > --- > This patch is dependent on the previously posted 'Drivers: hv: hv_balloon: > eliminate the trylock path in acquire/release_region_mutex'. > --- > drivers/hv/hv_balloon.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c > index 1283035..771bf84 100644 > --- a/drivers/hv/hv_balloon.c > +++ b/drivers/hv/hv_balloon.c > @@ -654,6 +654,7 @@ static void hv_mem_hot_add(unsigned long start, unsigned > long size, > } > has->ha_end_pfn -= HA_CHUNK; > has->covered_end_pfn -= processed_pfn; > + mutex_lock(&dm_device.ha_region_mutex); > break; > } > > -- > 1.9.3 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ >