All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] blk-cgroup: Fix memleak on error path
@ 2020-10-22 20:57 Gabriel Krisman Bertazi
       [not found] ` <20201022205758.1739430-1-krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Krisman Bertazi @ 2020-10-22 20:57 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, axboe-tSWWG44O7X1aa/9Udqfwiw
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, khazhy-hpIqsD4AKlfQT0dZR+AlfA,
	Gabriel Krisman Bertazi, kernel-ZGY8ohtN/8qB+jHODAdFcQ

If new_blkg allocation raced with blk_policy change and
blkg_lookup_check fails, new_blkg is leaked.

Signed-off-by: Gabriel Krisman Bertazi <krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
---
 block/blk-cgroup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
index f9b55614d67d..f9389b7cf823 100644
--- a/block/blk-cgroup.c
+++ b/block/blk-cgroup.c
@@ -663,6 +663,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;
 		}
 
-- 
2.28.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread
* [PATCH v2 0/2] Fixes to blkg_conf_prep
@ 2020-10-22 20:58 Gabriel Krisman Bertazi
       [not found] ` <20201022205842.1739739-1-krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Krisman Bertazi @ 2020-10-22 20:58 UTC (permalink / raw)
  To: tj-DgEjT+Ai2ygdnm+yROfE0A, axboe-tSWWG44O7X1aa/9Udqfwiw
  Cc: cgroups-u79uwXL29TY76Z2rM5mHXA, khazhy-hpIqsD4AKlfQT0dZR+AlfA,
	Gabriel Krisman Bertazi, kernel-ZGY8ohtN/8qB+jHODAdFcQ

Hi Tejun,

In addition to addressing your comments the previously submitted fix to
pre-allocate the radix node on blkg_conf_prep, this series fixes a small
memleak on the same function.

Gabriel Krisman Bertazi (2):
  blk-cgroup: Fix memleak on error path
  blk-cgroup: Pre-allocate tree node on blkg_conf_prep

 block/blk-cgroup.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

-- 
2.28.0


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

end of thread, other threads:[~2020-10-26 13:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-22 20:57 [PATCH v2 1/2] blk-cgroup: Fix memleak on error path Gabriel Krisman Bertazi
     [not found] ` <20201022205758.1739430-1-krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-10-22 20:57   ` [PATCH v2 2/2] blk-cgroup: Pre-allocate tree node on blkg_conf_prep Gabriel Krisman Bertazi
2020-10-22 20:59   ` [PATCH v2 1/2] blk-cgroup: Fix memleak on error path Gabriel Krisman Bertazi
  -- strict thread matches above, loose matches on Subject: below --
2020-10-22 20:58 [PATCH v2 0/2] Fixes to blkg_conf_prep Gabriel Krisman Bertazi
     [not found] ` <20201022205842.1739739-1-krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-10-22 20:58   ` [PATCH v2 1/2] blk-cgroup: Fix memleak on error path Gabriel Krisman Bertazi
     [not found]     ` <20201022205842.1739739-2-krisman-ZGY8ohtN/8qB+jHODAdFcQ@public.gmane.org>
2020-10-26 13:54       ` 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.