Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753835AbdDNGYO (ORCPT ); Fri, 14 Apr 2017 02:24:14 -0400 Received: from smtp2.provo.novell.com ([137.65.250.81]:56526 "EHLO smtp2.provo.novell.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751314AbdDNGYM (ORCPT ); Fri, 14 Apr 2017 02:24:12 -0400 Subject: Re: [PATCH] md-cluster: Fix a memleak in an error handling path To: Christophe JAILLET , shli@kernel.org References: <20170414060803.12472-1-christophe.jaillet@wanadoo.fr> Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org From: Guoqing Jiang Message-ID: <58F06AFC.509@suse.com> Date: Fri, 14 Apr 2017 14:23:56 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <20170414060803.12472-1-christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1081 Lines: 33 On 04/14/2017 02:08 PM, Christophe JAILLET wrote: > We know that 'bm_lockres' is NULL here, so 'lockres_free(bm_lockres)' is a > no-op. According to resource handling in case of error a few lines below, > it is likely that 'bitmap_free(bitmap)' was expected instead. > > Fixes: b98938d16a10 ("md-cluster: introduce cluster_check_sync_size") Reviewed-by: Guoqing Jiang Thanks, Guoqing > > Signed-off-by: Christophe JAILLET > --- > drivers/md/md-cluster.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c > index b21ef58819f6..7299ce2f08a8 100644 > --- a/drivers/md/md-cluster.c > +++ b/drivers/md/md-cluster.c > @@ -1127,7 +1127,7 @@ int cluster_check_sync_size(struct mddev *mddev) > bm_lockres = lockres_init(mddev, str, NULL, 1); > if (!bm_lockres) { > pr_err("md-cluster: Cannot initialize %s\n", str); > - lockres_free(bm_lockres); > + bitmap_free(bitmap); > return -1; > } > bm_lockres->flags |= DLM_LKF_NOQUEUE;