Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1623532 > unrolled thread

[PATCH] md-cluster: Fix a memleak in an error handling path

Started byChristophe JAILLET <christophe.jaillet@wanadoo.fr>
First post2017-04-14 08:10 +0200
Last post2017-04-14 08:30 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] md-cluster: Fix a memleak in an error handling path Christophe JAILLET <christophe.jaillet@wanadoo.fr> - 2017-04-14 08:10 +0200
    Re: [PATCH] md-cluster: Fix a memleak in an error handling path Guoqing Jiang <gqjiang@suse.com> - 2017-04-14 08:30 +0200

#1623532 — [PATCH] md-cluster: Fix a memleak in an error handling path

FromChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Date2017-04-14 08:10 +0200
Subject[PATCH] md-cluster: Fix a memleak in an error handling path
Message-ID<tw2AG-61v-13@gated-at.bofh.it>
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 <christophe.jaillet@wanadoo.fr>
---
 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

[toc] | [next] | [standalone]


#1623539

FromGuoqing Jiang <gqjiang@suse.com>
Date2017-04-14 08:30 +0200
Message-ID<tw2U1-67D-5@gated-at.bofh.it>
In reply to#1623532

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 <gqjiang@suse.com>

Thanks,
Guoqing

>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   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;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web