YueHaibing
dd6734e179
exec: Fix mem leak in kernel_read_file
commit f612acfae8 upstream.
syzkaller report this:
BUG: memory leak
unreferenced object 0xffffc9000488d000 (size 9195520):
comm "syz-executor.0", pid 2752, jiffies 4294787496 (age 18.757s)
hex dump (first 32 bytes):
ff ff ff ff ff ff ff ff a8 00 00 00 01 00 00 00 ................
02 00 00 00 00 00 00 00 80 a1 7a c1 ff ff ff ff ..........z.....
backtrace:
[<000000000863775c>] __vmalloc_node mm/vmalloc.c:1795 [inline]
[<000000000863775c>] __vmalloc_node_flags mm/vmalloc.c:1809 [inline]
[<000000000863775c>] vmalloc+0x8c/0xb0 mm/vmalloc.c:1831
[<000000003f668111>] kernel_read_file+0x58f/0x7d0 fs/exec.c:924
[<000000002385813f>] kernel_read_file_from_fd+0x49/0x80 fs/exec.c:993
[<0000000011953ff1>] __do_sys_finit_module+0x13b/0x2a0 kernel/module.c:3895
[<000000006f58491f>] do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290
[<00000000ee78baf4>] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[<00000000241f889b>] 0xffffffffffffffff
It should goto 'out_free' lable to free allocated buf while kernel_read
fails.
Fixes: 39d637af5a ("vfs: forbid write access when reading a file into memory")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Cc: Thibaut Sautereau <thibaut@sautereau.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-13 14:04:55 -07:00
..
2018-12-01 09:44:18 +01:00
2018-05-30 07:50:16 +02:00
2018-09-19 22:47:16 +02:00
2018-12-01 09:44:19 +01:00
2019-02-23 09:05:59 +01:00
2018-12-17 09:38:34 +01:00
2019-02-27 10:06:58 +01:00
2019-02-20 10:18:30 +01:00
2018-11-21 09:26:03 +01:00
2018-11-13 11:17:03 -08:00
2018-08-03 07:55:20 +02:00
2019-02-15 08:07:38 +01:00
2019-02-12 19:44:51 +01:00
2018-05-30 07:50:16 +02:00
2018-11-27 16:09:38 +01:00
2018-12-17 09:38:33 +01:00
2018-12-05 19:42:40 +01:00
2019-01-16 22:12:33 +01:00
2019-02-12 19:44:58 +01:00
2018-11-10 07:42:56 -08:00
2018-12-17 09:38:34 +01:00
2019-02-12 19:45:00 +01:00
2019-02-06 17:33:28 +01:00
2018-12-17 09:38:35 +01:00
2018-12-17 09:38:35 +01:00
2019-03-13 14:04:54 -07:00
2018-11-13 11:16:55 -08:00
2019-01-26 09:38:33 +01:00
2018-08-09 12:18:00 +02:00
2018-12-08 13:05:05 +01:00
2018-11-13 11:17:02 -08:00
2019-03-13 14:04:52 -07:00
2019-02-12 19:44:57 +01:00
2018-02-03 17:05:38 +01:00
2019-02-15 08:07:39 +01:00
2018-05-30 07:50:16 +02:00
2019-02-06 17:33:30 +01:00
2019-02-12 19:44:58 +01:00
2018-11-10 07:42:46 -08:00
2018-04-13 19:48:12 +02:00
2019-02-27 10:06:58 +01:00
2019-01-26 09:38:33 +01:00
2018-09-09 20:01:26 +02:00
2018-11-27 16:09:38 +01:00
2018-09-05 09:20:03 +02:00
2018-09-05 09:20:10 +02:00
2018-12-17 09:38:32 +01:00
2018-12-29 13:40:16 +01:00
2019-02-12 19:44:55 +01:00
2018-11-10 07:42:49 -08:00
2018-12-08 13:05:15 +01:00
2018-12-21 14:11:31 +01:00
2018-09-26 08:36:37 +02:00
2018-06-26 08:08:09 +08:00
2019-02-15 09:07:33 +01:00
2019-01-23 08:10:56 +01:00
2018-02-25 11:05:55 +01:00
2018-04-08 12:12:44 +02:00
2018-02-28 10:18:33 +01:00
2019-02-06 17:33:28 +01:00
2019-03-05 17:57:05 +01:00
2019-02-12 19:44:59 +01:00
2019-03-13 14:04:55 -07:00
2018-01-31 12:55:52 +01:00
2018-05-16 10:08:42 +02:00
2018-07-17 11:37:53 +02:00
2018-02-22 15:43:48 +01:00
2018-12-01 09:44:25 +01:00
2018-11-21 09:26:02 +01:00
2018-02-17 13:21:15 +01:00
2018-02-17 13:21:18 +01:00
2019-02-06 17:33:26 +01:00
2019-02-06 17:33:29 +01:00
2018-10-10 08:53:22 +02:00