Takeshi Misawa
39be7b978f
net: qrtr: Fix memory leak in qrtr_tun_open
...
commit fc0494ead6398609c49afa37bc949b61c5c16b91 upstream.
If qrtr_endpoint_register() failed, tun is leaked.
Fix this, by freeing tun in error path.
syzbot report:
BUG: memory leak
unreferenced object 0xffff88811848d680 (size 64):
comm "syz-executor684", pid 10171, jiffies 4294951561 (age 26.070s)
hex dump (first 32 bytes):
80 dd 0a 84 ff ff ff ff 00 00 00 00 00 00 00 00 ................
90 d6 48 18 81 88 ff ff 90 d6 48 18 81 88 ff ff ..H.......H.....
backtrace:
[<0000000018992a50>] kmalloc include/linux/slab.h:552 [inline]
[<0000000018992a50>] kzalloc include/linux/slab.h:682 [inline]
[<0000000018992a50>] qrtr_tun_open+0x22/0x90 net/qrtr/tun.c:35
[<0000000003a453ef>] misc_open+0x19c/0x1e0 drivers/char/misc.c:141
[<00000000dec38ac8>] chrdev_open+0x10d/0x340 fs/char_dev.c:414
[<0000000079094996>] do_dentry_open+0x1e6/0x620 fs/open.c:817
[<000000004096d290>] do_open fs/namei.c:3252 [inline]
[<000000004096d290>] path_openat+0x74a/0x1b00 fs/namei.c:3369
[<00000000b8e64241>] do_filp_open+0xa0/0x190 fs/namei.c:3396
[<00000000a3299422>] do_sys_openat2+0xed/0x230 fs/open.c:1172
[<000000002c1bdcef>] do_sys_open fs/open.c:1188 [inline]
[<000000002c1bdcef>] __do_sys_openat fs/open.c:1204 [inline]
[<000000002c1bdcef>] __se_sys_openat fs/open.c:1199 [inline]
[<000000002c1bdcef>] __x64_sys_openat+0x7f/0xe0 fs/open.c:1199
[<00000000f3a5728f>] do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
[<000000004b38b7ec>] entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: 28fb4e59a47d ("net: qrtr: Expose tunneling endpoint to user space")
Reported-by: syzbot+5d6e4af21385f5cfc56a@syzkaller.appspotmail.com
Signed-off-by: Takeshi Misawa <jeliantsurux@gmail.com>
Link: https://lore.kernel.org/r/20210221234427.GA2140@DESKTOP
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-03-04 10:26:53 +01:00
..
2020-11-05 11:43:20 +01:00
2021-01-17 14:05:31 +01:00
2020-08-11 15:33:40 +02:00
2020-10-01 13:17:58 +02:00
2020-07-31 18:39:31 +02:00
2020-12-02 08:49:50 +01:00
2021-03-04 10:26:14 +01:00
2019-07-25 18:00:41 -07:00
2020-04-21 09:04:53 +02:00
2021-02-23 15:02:25 +01:00
2019-10-28 13:33:41 -07:00
2020-12-11 13:23:32 +01:00
2020-11-05 11:43:34 +01:00
2021-03-04 10:26:17 +01:00
2021-01-23 15:57:59 +01:00
2020-06-17 16:40:32 +02:00
2020-01-04 19:18:58 +01:00
2020-04-23 10:36:45 +02:00
2021-02-17 10:35:19 +01:00
2020-01-09 10:20:06 +01:00
2020-04-21 09:04:44 +02:00
2020-03-18 07:17:44 +01:00
2019-09-26 08:56:17 +02:00
2021-03-04 10:26:53 +01:00
2021-03-04 10:26:53 +01:00
2020-12-08 10:40:23 +01:00
2019-09-27 10:27:14 +02:00
2021-02-13 13:52:54 +01:00
2020-07-22 09:32:47 +02:00
2021-02-10 09:25:28 +01:00
2020-10-01 13:17:15 +02:00
2021-03-04 10:26:17 +01:00
2020-10-01 13:18:17 +02:00
2019-12-18 16:08:42 +01:00
2021-01-12 20:16:13 +01:00
2021-02-17 10:35:17 +01:00
2020-11-24 13:28:57 +01:00
2020-07-22 09:32:46 +02:00
2020-04-29 16:33:08 +02:00
2021-02-03 23:26:01 +01:00
2020-12-08 10:40:27 +01:00
2020-09-09 19:12:29 +02:00
2019-10-28 13:33:41 -07:00
2019-12-04 22:30:54 +01:00
2021-03-04 10:26:53 +01:00
2021-02-17 10:35:19 +01:00
2020-11-24 13:29:05 +01:00
2020-12-08 10:40:23 +01:00
2021-02-17 10:35:18 +01:00
2021-03-04 10:26:53 +01:00
2021-02-17 10:35:19 +01:00
2020-11-24 13:28:58 +01:00
2021-02-13 13:52:56 +01:00
2021-02-07 15:35:46 +01:00
2021-01-23 15:58:00 +01:00
2020-12-08 10:40:23 +01:00
2020-10-01 13:17:31 +02:00
2021-02-17 10:35:19 +01:00
2019-08-10 15:25:47 -07:00
2021-02-03 23:25:56 +01:00
2020-12-08 10:40:26 +01:00
2020-12-30 11:50:53 +01:00
2021-03-04 10:26:53 +01:00
2020-08-21 13:05:25 +02:00
2020-04-01 11:02:18 +02:00
2020-08-19 08:16:22 +02:00