YueHaibing
b60d90b2d3
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-10 07:17:21 +01:00
..
2018-12-01 09:37:27 +01:00
2018-08-22 10:52:51 -07:00
2019-02-27 10:08:56 +01:00
2018-08-22 12:34:08 -07:00
2018-12-01 09:37:27 +01:00
2019-02-12 19:47:11 +01:00
2018-12-17 09:24:40 +01:00
2019-02-27 10:08:50 +01:00
2019-02-20 10:25:44 +01:00
2018-11-13 11:08:55 -08:00
2018-11-13 11:08:46 -08:00
2019-02-15 08:10:11 +01:00
2018-08-21 23:54:17 -04:00
2019-02-12 19:46:58 +01:00
2018-07-22 14:13:44 +02:00
2018-11-27 16:13:00 +01:00
2018-12-17 09:24:35 +01:00
2018-12-05 19:32:11 +01:00
2019-02-15 08:10:13 +01:00
2019-02-12 19:47:17 +01:00
2018-10-13 09:31:03 +02:00
2018-12-17 09:24:40 +01:00
2019-02-12 19:47:24 +01:00
2019-02-06 17:30:13 +01:00
2018-12-17 09:24:41 +01:00
2018-12-17 09:24:41 +01:00
2018-08-17 16:20:28 -07:00
2018-08-25 12:42:33 -07:00
2019-03-05 17:58:53 +01:00
2018-08-21 11:37:41 +02:00
2018-11-13 11:08:43 -08:00
2019-01-26 09:32:37 +01:00
2018-08-15 22:47:23 -07:00
2018-08-18 11:44:53 -07:00
2019-01-13 09:51:08 +01:00
2019-02-12 19:47:16 +01:00
2019-02-20 10:25:47 +01:00
2018-09-04 16:45:02 -07:00
2019-01-31 08:14:34 +01:00
2018-08-17 16:20:27 -07:00
2019-02-12 19:47:18 +01:00
2018-08-14 12:07:14 -04:00
2018-12-19 19:19:51 +01:00
2019-02-27 10:08:50 +01:00
2019-01-26 09:32:37 +01:00
2019-01-26 09:32:42 +01:00
2018-11-27 16:12:59 +01:00
2018-08-02 09:34:02 -07:00
2018-08-18 11:44:53 -07:00
2018-12-17 09:24:30 +01:00
2018-07-31 11:32:44 -04:00
2018-12-29 13:37:55 +01:00
2019-02-12 19:47:09 +01:00
2018-08-17 16:20:27 -07:00
2019-02-12 19:47:23 +01:00
2019-03-10 07:17:21 +01:00
2018-08-13 19:24:32 -07:00
2019-02-15 09:09:54 +01:00
2019-01-22 21:40:36 +01:00
2018-08-30 12:56:40 +02:00
2018-07-30 16:21:49 -04:00
2019-01-09 17:38:46 +01:00
2019-02-06 17:30:11 +01:00
2019-03-05 17:58:50 +01:00
2019-02-12 19:47:19 +01:00
2019-03-10 07:17:21 +01:00
2018-08-15 23:03:20 -05:00
2018-08-21 18:19:09 -07:00
2019-03-05 17:58:50 +01:00
2019-02-20 10:25:47 +01:00
2018-08-21 18:19:09 -07:00
2018-11-21 09:19:14 +01:00
2019-01-26 09:32:43 +01:00
2018-08-02 08:06:55 +09:00
2018-08-21 18:19:09 -07:00
2018-08-17 16:20:29 -07:00
2018-12-29 13:37:54 +01:00
2018-11-21 09:19:22 +01:00
2018-08-21 18:19:09 -07:00
2018-08-13 19:58:36 -07:00
2018-09-24 10:54:01 +02:00
2018-08-17 16:20:28 -07:00
2018-08-26 11:48:42 -07:00
2018-08-13 20:56:23 -07:00
2019-01-26 09:32:43 +01:00
2018-09-18 07:30:48 -04:00