From: Tejun Heo <tj@kernel.org>
To: Qinglang Miao <miaoqinglang@huawei.com>
Cc: Li Zefan <lizefan@huawei.com>,
Johannes Weiner <hannes@cmpxchg.org>,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] cgroup: Fix memory leak when parsing multiple source parameters
Date: Wed, 16 Dec 2020 10:11:36 -0500 [thread overview]
Message-ID: <X9ojqIbV/SxSrNy7@mtj.duckdns.org> (raw)
In-Reply-To: <20201210012943.92845-1-miaoqinglang@huawei.com>
On Thu, Dec 10, 2020 at 09:29:43AM +0800, Qinglang Miao wrote:
> A memory leak is found in cgroup1_parse_param() when multiple source
> parameters overwrite fc->source in the fs_context struct without free.
>
> unreferenced object 0xffff888100d930e0 (size 16):
> comm "mount", pid 520, jiffies 4303326831 (age 152.783s)
> hex dump (first 16 bytes):
> 74 65 73 74 6c 65 61 6b 00 00 00 00 00 00 00 00 testleak........
> backtrace:
> [<000000003e5023ec>] kmemdup_nul+0x2d/0xa0
> [<00000000377dbdaa>] vfs_parse_fs_string+0xc0/0x150
> [<00000000cb2b4882>] generic_parse_monolithic+0x15a/0x1d0
> [<000000000f750198>] path_mount+0xee1/0x1820
> [<0000000004756de2>] do_mount+0xea/0x100
> [<0000000094cafb0a>] __x64_sys_mount+0x14b/0x1f0
>
> Fix this bug by permitting a single source parameter and rejecting with
> an error all subsequent ones.
>
> Fixes: 8d2451f4994f ("cgroup1: switch to option-by-option parsing")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Applied to cgroup/for-5.11.
Thanks.
--
tejun
next prev parent reply other threads:[~2020-12-16 15:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-09 12:13 [PATCH] " Qinglang Miao
2020-12-09 13:59 ` kernel test robot
2020-12-09 15:33 ` kernel test robot
2020-12-10 1:29 ` [PATCH v2] " Qinglang Miao
2020-12-15 8:50 ` Zefan Li
2020-12-16 15:11 ` Tejun Heo [this message]
2020-12-15 8:39 ` [PATCH] " Zefan Li
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=X9ojqIbV/SxSrNy7@mtj.duckdns.org \
--to=tj@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizefan@huawei.com \
--cc=miaoqinglang@huawei.com \
/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®