From: Wu Bo <wubo40@huawei.com>
To: <tj@kernel.org>, <axboe@kernel.dk>
Cc: <cgroups@vger.kernel.org>, <linux-block@vger.kernel.org>,
<Markus.Elfring@web.de>, <linux-kernel@vger.kernel.org>,
<liuzhiqiang26@huawei.com>, <linfeilong@huawei.com>,
<wubo40@huawei.com>
Subject: [PATCH] blkcg:Fix memory leaks in blkg_conf_prep()
Date: Mon, 18 May 2020 20:36:06 +0800 [thread overview]
Message-ID: <1589805366-328489-1-git-send-email-wubo40@huawei.com> (raw)
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
next reply other threads:[~2020-05-18 12:22 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 12:36 Wu Bo [this message]
2020-05-18 14:06 ` [PATCH v2] blkcg: Fix memory leak " Markus Elfring
2020-05-26 17:23 ` [PATCH] blkcg:Fix memory leaks " Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1589805366-328489-1-git-send-email-wubo40@huawei.com \
--to=wubo40@huawei.com \
--cc=Markus.Elfring@web.de \
--cc=axboe@kernel.dk \
--cc=cgroups@vger.kernel.org \
--cc=linfeilong@huawei.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®