All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md-cluster: Fix a memleak in an error handling path
@ 2017-04-14  6:08 ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-04-14  6:08 UTC (permalink / raw)
  To: shli, gqjiang
  Cc: linux-raid, linux-kernel, kernel-janitors, Christophe JAILLET

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] md-cluster: Fix a memleak in an error handling path
@ 2017-04-14  6:08 ` Christophe JAILLET
  0 siblings, 0 replies; 4+ messages in thread
From: Christophe JAILLET @ 2017-04-14  6:08 UTC (permalink / raw)
  To: shli, gqjiang
  Cc: linux-raid, linux-kernel, kernel-janitors, Christophe JAILLET

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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] md-cluster: Fix a memleak in an error handling path
  2017-04-14  6:08 ` Christophe JAILLET
@ 2017-04-14  6:23   ` Guoqing Jiang
  -1 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2017-04-14  6:23 UTC (permalink / raw)
  To: Christophe JAILLET, shli; +Cc: linux-raid, linux-kernel, kernel-janitors



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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] md-cluster: Fix a memleak in an error handling path
@ 2017-04-14  6:23   ` Guoqing Jiang
  0 siblings, 0 replies; 4+ messages in thread
From: Guoqing Jiang @ 2017-04-14  6:23 UTC (permalink / raw)
  To: Christophe JAILLET, shli; +Cc: linux-raid, linux-kernel, kernel-janitors



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;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-04-14  6:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14  6:08 [PATCH] md-cluster: Fix a memleak in an error handling path Christophe JAILLET
2017-04-14  6:08 ` Christophe JAILLET
2017-04-14  6:23 ` Guoqing Jiang
2017-04-14  6:23   ` Guoqing Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.