All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] blkcg:Fix memory leaks in blkg_conf_prep()
@ 2020-05-18 12:36 ` Wu Bo
  0 siblings, 0 replies; 6+ messages in thread
From: Wu Bo @ 2020-05-18 12:36 UTC (permalink / raw)
  To: tj, axboe
  Cc: cgroups, linux-block, Markus.Elfring, linux-kernel,
	liuzhiqiang26, linfeilong, wubo40

From: Wu Bo <wubo40@huawei.com>

If a call of the function blkg_lookup_check() failed,
we should be release the previously allocated block group 
before jumping to the lable 'fail_unlock' in the implementation of 
the function blkg_conf_prep().

Suggested-by: Markus Elfring <Markus.Elfring@web.de>
Signed-off-by: Wu Bo <wubo40@huawei.com>

---
V2: omit the source code quotation from 
    the change description

---
 block/blk-cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 930212c..afeb769 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -682,6 +682,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 		blkg = blkg_lookup_check(pos, pol, q);
 		if (IS_ERR(blkg)) {
 			ret = PTR_ERR(blkg);
+			blkg_free(new_blkg);
 			goto fail_unlock;
 		}
 
-- 
1.8.3.1


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

* [PATCH] blkcg:Fix memory leaks in blkg_conf_prep()
@ 2020-05-18 12:36 ` Wu Bo
  0 siblings, 0 replies; 6+ messages in thread
From: Wu Bo @ 2020-05-18 12:36 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, axboe-tSWWG44O7X1aa/9Udqfwiw
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-block-u79uwXL29TY76Z2rM5mHXA, Markus.Elfring-S0/GAf8tV78,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	liuzhiqiang26-hv44wF8Li93QT0dZR+AlfA,
	linfeilong-hv44wF8Li93QT0dZR+AlfA, wubo40-hv44wF8Li93QT0dZR+AlfA

From: Wu Bo <wubo40-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

If a call of the function blkg_lookup_check() failed,
we should be release the previously allocated block group 
before jumping to the lable 'fail_unlock' in the implementation of 
the function blkg_conf_prep().

Suggested-by: Markus Elfring <Markus.Elfring-S0/GAf8tV78@public.gmane.org>
Signed-off-by: Wu Bo <wubo40-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>

---
V2: omit the source code quotation from 
    the change description

---
 block/blk-cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index 930212c..afeb769 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -682,6 +682,7 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
 		blkg = blkg_lookup_check(pos, pol, q);
 		if (IS_ERR(blkg)) {
 			ret = PTR_ERR(blkg);
+			blkg_free(new_blkg);
 			goto fail_unlock;
 		}
 
-- 
1.8.3.1


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

* Re: [PATCH v2] blkcg: Fix memory leak in blkg_conf_prep()
  2020-05-18 12:36 ` Wu Bo
  (?)
@ 2020-05-18 14:06   ` Markus Elfring
  -1 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-05-18 14:06 UTC (permalink / raw)
  To: Wu Bo, cgroups, linux-block
  Cc: linux-kernel, kernel-janitors, Feilong Lin, Jens Axboe,
	Tejun Heo, Zhiqiang Liu

> If a call of the function blkg_lookup_check() failed,

Thanks that you would like to integrate something from my suggestion.


> we should be release the previously allocated block group

I find that an other wording would be preferred over “we should”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce#n151


> before jumping to the lable 'fail_unlock' in the implementation of

Please avoid another typo here.


> the function blkg_conf_prep().
>
> Suggested-by: Markus Elfring <Markus.Elfring@web.de>

I find this tag questionable because the bug fix was presented before.
https://lore.kernel.org/linux-block/4c670a6c-98c3-2b14-7438-09199506d92f@web.de/
https://lkml.org/lkml/2020/5/15/779


> ---
> V2: omit the source code quotation from
>     the change description

* I recommend to improve also the patch subject accordingly.

* Would you like to move the name from the previous tag into
  this information?


> ---
>  block/blk-cgroup.c | 1 +

I suggest to omit the triple dashes before this diffstat.

Regards,
Markus

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

* Re: [PATCH v2] blkcg: Fix memory leak in blkg_conf_prep()
@ 2020-05-18 14:06   ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-05-18 14:06 UTC (permalink / raw)
  To: Wu Bo, cgroups, linux-block
  Cc: linux-kernel, kernel-janitors, Feilong Lin, Jens Axboe,
	Tejun Heo, Zhiqiang Liu

> If a call of the function blkg_lookup_check() failed,

Thanks that you would like to integrate something from my suggestion.


> we should be release the previously allocated block group

I find that an other wording would be preferred over “we should”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce#n151


> before jumping to the lable 'fail_unlock' in the implementation of

Please avoid another typo here.


> the function blkg_conf_prep().
>
> Suggested-by: Markus Elfring <Markus.Elfring@web.de>

I find this tag questionable because the bug fix was presented before.
https://lore.kernel.org/linux-block/4c670a6c-98c3-2b14-7438-09199506d92f@web.de/
https://lkml.org/lkml/2020/5/15/779


> ---
> V2: omit the source code quotation from
>     the change description

* I recommend to improve also the patch subject accordingly.

* Would you like to move the name from the previous tag into
  this information?


> ---
>  block/blk-cgroup.c | 1 +

I suggest to omit the triple dashes before this diffstat.

Regards,
Markus

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

* Re: [PATCH v2] blkcg: Fix memory leak in blkg_conf_prep()
@ 2020-05-18 14:06   ` Markus Elfring
  0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-05-18 14:06 UTC (permalink / raw)
  To: Wu Bo, cgroups-u79uwXL29TY76Z2rM5mHXA,
	linux-block-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA, Feilong Lin, Jens Axboe,
	Tejun Heo, Zhiqiang Liu

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="windows-1254", Size: 1210 bytes --]

> If a call of the function blkg_lookup_check() failed,

Thanks that you would like to integrate something from my suggestion.


> we should be release the previously allocated block group

I find that an other wording would be preferred over “we should”.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=b9bbe6ed63b2b9f2c9ee5cbd0f2c946a2723f4ce#n151


> before jumping to the lable 'fail_unlock' in the implementation of

Please avoid another typo here.


> the function blkg_conf_prep().
>
> Suggested-by: Markus Elfring <Markus.Elfring-S0/GAf8tV78@public.gmane.org>

I find this tag questionable because the bug fix was presented before.
https://lore.kernel.org/linux-block/4c670a6c-98c3-2b14-7438-09199506d92f@web.de/
https://lkml.org/lkml/2020/5/15/779


> ---
> V2: omit the source code quotation from
>     the change description

* I recommend to improve also the patch subject accordingly.

* Would you like to move the name from the previous tag into
  this information?


> ---
>  block/blk-cgroup.c | 1 +

I suggest to omit the triple dashes before this diffstat.

Regards,
Markus

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

* Re: [PATCH] blkcg:Fix memory leaks in blkg_conf_prep()
  2020-05-18 12:36 ` Wu Bo
  (?)
  (?)
@ 2020-05-26 17:23 ` Tejun Heo
  -1 siblings, 0 replies; 6+ messages in thread
From: Tejun Heo @ 2020-05-26 17:23 UTC (permalink / raw)
  To: Wu Bo
  Cc: axboe, cgroups, linux-block, Markus.Elfring, linux-kernel,
	liuzhiqiang26, linfeilong

On Mon, May 18, 2020 at 08:36:06PM +0800, Wu Bo wrote:
> From: Wu Bo <wubo40@huawei.com>
> 
> If a call of the function blkg_lookup_check() failed,
> we should be release the previously allocated block group 
> before jumping to the lable 'fail_unlock' in the implementation of 
> the function blkg_conf_prep().
> 
> Suggested-by: Markus Elfring <Markus.Elfring@web.de>
> Signed-off-by: Wu Bo <wubo40@huawei.com>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

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

end of thread, other threads:[~2020-05-26 17:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-18 12:36 [PATCH] blkcg:Fix memory leaks in blkg_conf_prep() Wu Bo
2020-05-18 12:36 ` Wu Bo
2020-05-18 14:06 ` [PATCH v2] blkcg: Fix memory leak " Markus Elfring
2020-05-18 14:06   ` Markus Elfring
2020-05-18 14:06   ` Markus Elfring
2020-05-26 17:23 ` [PATCH] blkcg:Fix memory leaks " Tejun Heo

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.