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
WARNING: multiple messages have this Message-ID (diff)
From: Wu Bo <wubo40-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> To: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Markus.Elfring-S0/GAf8tV78@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, liuzhiqiang26-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, linfeilong-hv44wF8Li93QT0dZR+AlfA@public.gmane.org, wubo40-hv44wF8Li93QT0dZR+AlfA@public.gmane.org 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-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
next reply other threads:[~2020-05-18 12:22 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-18 12:36 Wu Bo [this message] 2020-05-18 12:36 ` [PATCH] blkcg:Fix memory leaks in blkg_conf_prep() 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
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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.