Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753554AbdDNGIz (ORCPT ); Fri, 14 Apr 2017 02:08:55 -0400 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:56409 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751964AbdDNGIx (ORCPT ); Fri, 14 Apr 2017 02:08:53 -0400 X-ME-Helo: localhost.localdomain X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 14 Apr 2017 08:08:51 +0200 X-ME-IP: 92.140.232.30 From: Christophe JAILLET To: shli@kernel.org, gqjiang@suse.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] md-cluster: Fix a memleak in an error handling path Date: Fri, 14 Apr 2017 08:08:03 +0200 Message-Id: <20170414060803.12472-1-christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 922 Lines: 26 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") 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; -- 2.11.0