Kefeng Wang
bb64c41da3
media: wl128x: Fix some error handling in fm_v4l2_init_video_device()
...
[ Upstream commit 69fbb3f473
]
X-Originating-IP: [10.175.113.25]
X-CFilter-Loop: Reflected
The fm_v4l2_init_video_device() forget to unregister v4l2/video device
in the error path, it could lead to UAF issue, eg,
BUG: KASAN: use-after-free in atomic64_read include/asm-generic/atomic-instrumented.h:836 [inline]
BUG: KASAN: use-after-free in atomic_long_read include/asm-generic/atomic-long.h:28 [inline]
BUG: KASAN: use-after-free in __mutex_unlock_slowpath+0x92/0x690 kernel/locking/mutex.c:1206
Read of size 8 at addr ffff8881e84a7c70 by task v4l_id/3659
CPU: 1 PID: 3659 Comm: v4l_id Not tainted 5.1.0 #8
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xa9/0x10e lib/dump_stack.c:113
print_address_description+0x65/0x270 mm/kasan/report.c:187
kasan_report+0x149/0x18d mm/kasan/report.c:317
atomic64_read include/asm-generic/atomic-instrumented.h:836 [inline]
atomic_long_read include/asm-generic/atomic-long.h:28 [inline]
__mutex_unlock_slowpath+0x92/0x690 kernel/locking/mutex.c:1206
fm_v4l2_fops_open+0xac/0x120 [fm_drv]
v4l2_open+0x191/0x390 [videodev]
chrdev_open+0x20d/0x570 fs/char_dev.c:417
do_dentry_open+0x700/0xf30 fs/open.c:777
do_last fs/namei.c:3416 [inline]
path_openat+0x7c4/0x2a90 fs/namei.c:3532
do_filp_open+0x1a5/0x2b0 fs/namei.c:3563
do_sys_open+0x302/0x490 fs/open.c:1069
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f8180c17c8e
...
Allocated by task 3642:
set_track mm/kasan/common.c:87 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:497
fm_drv_init+0x13/0x1000 [fm_drv]
do_one_initcall+0xbc/0x47d init/main.c:901
do_init_module+0x1b5/0x547 kernel/module.c:3456
load_module+0x6405/0x8c10 kernel/module.c:3804
__do_sys_finit_module+0x162/0x190 kernel/module.c:3898
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 3642:
set_track mm/kasan/common.c:87 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:459
slab_free_hook mm/slub.c:1429 [inline]
slab_free_freelist_hook mm/slub.c:1456 [inline]
slab_free mm/slub.c:3003 [inline]
kfree+0xe1/0x270 mm/slub.c:3958
fm_drv_init+0x1e6/0x1000 [fm_drv]
do_one_initcall+0xbc/0x47d init/main.c:901
do_init_module+0x1b5/0x547 kernel/module.c:3456
load_module+0x6405/0x8c10 kernel/module.c:3804
__do_sys_finit_module+0x162/0x190 kernel/module.c:3898
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Add relevant unregister functions to fix it.
Cc: Hans Verkuil <hans.verkuil@cisco.com >
Reported-by: Hulk Robot <hulkci@huawei.com >
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com >
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org >
Signed-off-by: Sasha Levin <sashal@kernel.org >
2019-08-04 09:33:18 +02:00
..
2019-05-14 19:19:34 +02:00
2019-06-11 12:22:44 +02:00
2019-06-22 08:17:18 +02:00
2019-02-27 10:06:59 +01:00
2019-05-31 06:48:26 -07:00
2019-05-10 17:52:09 +02:00
2018-11-27 16:09:40 +01:00
2018-12-05 19:42:41 +01:00
2019-04-05 22:29:12 +02:00
2019-05-31 06:48:29 -07:00
2019-07-10 09:55:44 +02:00
2019-03-23 13:19:46 +01:00
2019-05-31 06:48:27 -07:00
2019-02-12 19:44:55 +01:00
2019-08-04 09:33:17 +02:00
2019-08-04 09:33:14 +02:00
2018-06-06 16:44:33 +02:00
2018-11-13 11:16:56 -08:00
2019-05-31 06:48:26 -07:00
2018-05-30 07:50:18 +02:00
2019-06-11 12:22:45 +02:00
2019-06-22 08:17:23 +02:00
2019-07-10 09:55:46 +02:00
2019-05-31 06:48:29 -07:00
2018-12-29 13:40:15 +01:00
2019-07-10 09:55:32 +02:00
2019-05-25 18:26:46 +02:00
2019-06-22 08:17:23 +02:00
2018-12-21 14:11:37 +01:00
2019-05-14 19:19:34 +02:00
2019-05-31 06:48:27 -07:00
2019-07-10 09:55:47 +02:00
2019-07-21 09:05:54 +02:00
2019-06-22 08:17:14 +02:00
2019-06-11 12:22:48 +02:00
2019-06-22 08:17:22 +02:00
2019-05-04 08:49:10 +02:00
2018-10-20 09:51:32 +02:00
2018-09-09 20:01:19 +02:00
2019-07-21 09:06:07 +02:00
2019-08-04 09:33:18 +02:00
2019-05-25 18:26:49 +02:00
2019-02-12 19:44:55 +01:00
2019-07-10 09:55:44 +02:00
2019-07-21 09:06:03 +02:00
2019-05-31 06:48:25 -07:00
2019-02-15 08:07:37 +01:00
2019-08-04 09:33:17 +02:00
2019-05-16 19:43:43 +02:00
2018-05-30 07:50:22 +02:00
2019-05-31 06:48:11 -07:00
2019-07-10 09:55:32 +02:00
2019-06-22 08:17:15 +02:00
2018-12-01 09:44:21 +01:00
2019-06-11 12:22:47 +02:00
2019-07-10 09:55:29 +02:00
2019-06-22 08:17:17 +02:00
2018-11-13 11:16:46 -08:00
2019-02-27 10:07:03 +01:00
2019-05-31 06:48:18 -07:00
2019-06-22 08:17:16 +02:00
2019-05-25 18:26:56 +02:00
2019-05-14 19:19:34 +02:00
2019-02-12 19:44:52 +01:00
2019-06-22 08:17:17 +02:00
2019-06-22 08:17:11 +02:00
2019-04-05 22:29:14 +02:00
2018-12-08 13:05:08 +01:00
2018-11-13 11:17:03 -08:00
2019-06-22 08:17:21 +02:00
2019-07-21 09:06:08 +02:00
2018-12-21 14:11:36 +01:00
2019-07-10 09:55:43 +02:00
2019-06-22 08:17:15 +02:00
2019-07-10 09:55:43 +02:00
2019-05-31 06:48:12 -07:00
2019-08-04 09:33:17 +02:00
2019-03-23 13:19:47 +01:00
2018-11-13 11:17:02 -08:00
2019-06-22 08:17:13 +02:00
2019-07-21 09:06:00 +02:00
2018-11-27 16:09:41 +01:00
2019-07-21 09:06:01 +02:00
2018-10-03 17:01:42 -07:00
2019-05-08 07:19:10 +02:00
2019-04-27 09:34:40 +02:00
2019-06-22 08:17:17 +02:00
2019-05-16 19:43:47 +02:00
2019-04-17 08:36:47 +02:00
2019-05-31 06:48:15 -07:00
2019-06-22 08:17:14 +02:00
2019-06-11 12:22:49 +02:00
2018-05-30 07:50:44 +02:00