Qinglang Miao
2d18e54dd8
cgroup: Fix memory leak when parsing multiple source parameters
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: 8d2451f499 ("cgroup1: switch to option-by-option parsing")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Reviewed-by: Zefan Li <lizefan@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
2020-12-16 10:10:32 -05:00
..
2020-11-14 08:17:27 -08:00
2020-12-16 10:10:32 -05:00
2020-10-01 14:44:08 +01:00
2020-11-02 10:10:39 -05:00
2020-11-04 18:06:14 +01:00
2020-11-09 18:12:36 +01:00
2020-09-11 09:33:54 -07:00
2020-11-08 09:52:57 -08:00
2020-10-16 11:11:19 -07:00
2020-10-16 11:11:19 -07:00
2020-11-17 13:15:35 +01:00
2020-10-27 19:11:44 +01:00
2020-10-30 16:57:42 -05:00
2020-11-17 10:31:56 -08:00
2020-11-22 13:26:07 -08:00
2020-10-26 11:48:11 +01:00
2020-11-19 11:56:16 -08:00
2020-10-16 11:11:19 -07:00
2020-07-16 12:35:15 -07:00
2020-07-27 23:25:50 +02:00
2020-08-06 19:29:51 -07:00
2020-07-27 23:25:50 +02:00
2020-08-26 09:10:39 -04:00
2020-08-17 20:26:58 -04:00
2020-08-23 17:36:59 -05:00
2020-08-04 14:20:26 -07:00
2020-07-30 11:15:58 -07:00
2020-10-13 09:17:34 -07:00
2020-08-23 17:36:59 -05:00
2020-06-11 15:14:36 +02:00
2020-09-01 09:58:03 +02:00
2020-06-03 13:06:42 -07:00
2020-08-12 10:58:01 -07:00
2020-04-15 11:21:54 +02:00
2020-05-20 14:44:21 -05:00
2020-10-28 16:39:49 -04:00
2020-11-19 11:58:16 -08:00
2020-11-08 11:18:39 -08:00
2020-11-09 14:30:30 +01:00
2020-06-06 23:42:01 +09:00
2020-10-13 09:17:34 -07:00
2020-11-02 12:14:19 -08:00
2020-05-28 10:54:15 +02:00
2020-10-16 11:11:19 -07:00
2020-10-25 14:51:49 -07:00
2020-08-12 10:58:02 -07:00
2020-10-16 11:11:19 -07:00
2020-10-16 11:11:18 -07:00
2020-10-05 13:37:03 +02:00
2020-08-12 10:58:01 -07:00
2020-11-04 09:46:06 -05:00
2020-11-02 12:14:19 -08:00
2020-04-27 02:07:40 -04:00
2020-10-22 13:13:57 -07:00
2020-10-22 13:08:57 -07:00
2020-09-01 09:58:03 +02:00
2020-07-08 11:14:22 +02:00
2020-09-04 17:51:55 +10:00
2020-11-14 11:26:04 -08:00
2020-10-29 17:22:59 -05:00
2020-10-16 11:11:19 -07:00
2020-10-18 09:27:10 -07:00
2020-11-17 12:53:22 -08:00
2020-10-16 11:11:19 -07:00
2020-11-14 11:26:03 -08:00
2020-07-27 14:31:12 -04:00
2020-10-16 11:11:22 -07:00
2020-10-16 11:11:18 -07:00
2020-08-24 18:38:38 -07:00
2020-08-07 11:33:25 -07:00
2020-11-17 12:53:22 -08:00
2020-11-02 12:14:19 -08:00
2020-10-18 14:34:50 -07:00
2020-09-16 15:18:56 +02:00
2020-09-19 13:13:39 -07:00
2020-09-18 14:24:16 +01:00
2020-10-02 21:18:25 +02:00
2020-10-26 12:12:27 +01:00
2020-10-18 09:27:10 -07:00
2020-10-25 11:44:16 -07:00
2020-09-17 10:26:41 -07:00
2020-10-17 15:05:30 -06:00
2020-10-02 19:11:12 -07:00
2020-06-29 12:01:45 -07:00
2020-10-29 17:22:59 -05:00
2020-10-06 10:31:52 -07:00
2020-10-16 11:11:19 -07:00
2020-06-04 19:06:24 -07:00
2020-07-07 11:58:59 -05:00
2020-04-27 02:07:40 -04:00
2020-05-09 13:57:12 +02:00
2020-08-17 09:39:18 -07:00
2020-11-14 11:26:03 -08:00
2020-10-16 07:28:20 +02:00