Zhen Lei
087bff9acd
fbmem: Do not delete the mode that is still in use
...
commit 0af778269a522c988ef0b4188556aba97fb420cc upstream.
The execution of fb_delete_videomode() is not based on the result of the
previous fbcon_mode_deleted(). As a result, the mode is directly deleted,
regardless of whether it is still in use, which may cause UAF.
==================================================================
BUG: KASAN: use-after-free in fb_mode_is_equal+0x36e/0x5e0 \
drivers/video/fbdev/core/modedb.c:924
Read of size 4 at addr ffff88807e0ddb1c by task syz-executor.0/18962
CPU: 2 PID: 18962 Comm: syz-executor.0 Not tainted 5.10.45-rc1+ #3
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ...
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x137/0x1be lib/dump_stack.c:118
print_address_description+0x6c/0x640 mm/kasan/report.c:385
__kasan_report mm/kasan/report.c:545 [inline]
kasan_report+0x13d/0x1e0 mm/kasan/report.c:562
fb_mode_is_equal+0x36e/0x5e0 drivers/video/fbdev/core/modedb.c:924
fbcon_mode_deleted+0x16a/0x220 drivers/video/fbdev/core/fbcon.c:2746
fb_set_var+0x1e1/0xdb0 drivers/video/fbdev/core/fbmem.c:975
do_fb_ioctl+0x4d9/0x6e0 drivers/video/fbdev/core/fbmem.c:1108
vfs_ioctl fs/ioctl.c:48 [inline]
__do_sys_ioctl fs/ioctl.c:753 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Freed by task 18960:
kasan_save_stack mm/kasan/common.c:48 [inline]
kasan_set_track+0x3d/0x70 mm/kasan/common.c:56
kasan_set_free_info+0x17/0x30 mm/kasan/generic.c:355
__kasan_slab_free+0x108/0x140 mm/kasan/common.c:422
slab_free_hook mm/slub.c:1541 [inline]
slab_free_freelist_hook+0xd6/0x1a0 mm/slub.c:1574
slab_free mm/slub.c:3139 [inline]
kfree+0xca/0x3d0 mm/slub.c:4121
fb_delete_videomode+0x56a/0x820 drivers/video/fbdev/core/modedb.c:1104
fb_set_var+0x1f3/0xdb0 drivers/video/fbdev/core/fbmem.c:978
do_fb_ioctl+0x4d9/0x6e0 drivers/video/fbdev/core/fbmem.c:1108
vfs_ioctl fs/ioctl.c:48 [inline]
__do_sys_ioctl fs/ioctl.c:753 [inline]
__se_sys_ioctl+0xfb/0x170 fs/ioctl.c:739
do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: 13ff178ccd6d ("fbcon: Call fbcon_mode_deleted/new_modelist directly")
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Cc: <stable@vger.kernel.org> # v5.3+
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20210712085544.2828-1-thunder.leizhen@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-07-20 16:05:37 +02:00
..
2020-09-18 14:45:44 +02:00
2021-07-20 16:05:37 +02:00
2020-09-08 13:33:10 +02:00
2020-05-06 19:29:10 +02:00
2020-01-30 08:04:01 -08:00
2020-09-08 13:33:31 +02:00
2020-07-16 12:35:15 -07:00
2020-04-08 12:09:15 +02:00
2020-08-23 17:36:59 -05:00
2020-09-14 18:11:40 +02:00
2020-08-23 17:36:59 -05:00
2020-09-08 13:33:05 +02:00
2020-08-23 17:36:59 -05:00
2020-09-08 13:33:15 +02:00
2020-09-14 18:11:40 +02:00
2020-01-06 09:45:59 +01:00
2020-09-14 18:11:40 +02:00
2020-01-03 14:27:43 +01:00
2020-08-23 17:36:59 -05:00
2019-06-19 17:09:55 +02:00
2020-09-30 16:37:39 +02:00
2020-07-10 16:17:20 +02:00
2020-08-23 17:36:59 -05:00
2020-09-08 13:33:20 +02:00
2019-12-05 10:57:53 +02:00
2019-04-01 17:46:55 +02:00
2019-04-01 17:46:55 +02:00
2019-04-01 17:46:55 +02:00
2019-04-01 17:46:55 +02:00
2020-06-09 09:39:13 -07:00
2020-12-30 11:53:13 +01:00
2019-12-05 10:57:53 +02:00
2019-06-03 16:00:08 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-03-09 11:12:19 +01:00
2020-01-30 08:04:01 -08:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-01-15 17:31:50 +01:00
2019-12-05 10:57:53 +02:00
2020-08-23 17:36:59 -05:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-08-30 10:56:12 -07:00
2019-05-30 11:26:32 -07:00
2020-09-08 13:33:16 +02:00
2019-06-19 17:09:55 +02:00
2020-07-10 16:17:28 +02:00
2019-12-05 10:57:53 +02:00
2020-08-20 06:26:22 +02:00
2020-07-20 11:47:29 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-08-23 17:36:59 -05:00
2020-02-19 10:58:22 -08:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-07-20 11:47:29 +02:00
2020-08-23 17:36:59 -05:00
2019-12-05 10:57:53 +02:00
2021-05-26 12:06:57 +02:00
2020-06-09 09:39:13 -07:00
2020-06-17 10:57:41 -07:00
2021-04-07 15:00:11 +02:00
2020-09-08 13:33:17 +02:00
2021-05-26 12:06:54 +02:00
2021-07-14 16:56:15 +02:00
2021-03-04 11:37:36 +01:00
2019-12-05 10:57:53 +02:00
2020-07-20 11:47:29 +02:00
2020-10-15 10:46:16 -07:00
2019-12-05 10:57:53 +02:00
2020-07-20 11:47:29 +02:00
2020-04-12 22:09:35 +02:00
2020-07-10 16:17:24 +02:00
2020-01-03 14:27:49 +01:00
2020-08-23 17:36:59 -05:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-08-23 17:36:59 -05:00
2020-07-16 12:35:15 -07:00
2020-01-30 08:04:01 -08:00
2020-01-30 08:04:01 -08:00
2020-01-30 08:04:01 -08:00
2020-08-04 07:37:23 +02:00
2020-08-05 19:47:22 +02:00
2020-03-18 12:27:03 +01:00
2020-08-23 17:36:59 -05:00
2020-08-23 17:36:59 -05:00
2019-08-26 10:02:02 +02:00
2020-06-09 09:39:13 -07:00
2020-04-17 15:50:12 +02:00
2020-08-20 17:48:12 +02:00
2020-08-20 17:48:12 +02:00
2020-08-23 17:36:59 -05:00
2020-09-08 13:33:19 +02:00
2020-08-23 17:36:59 -05:00
2020-04-17 15:50:11 +02:00
2020-01-30 08:04:01 -08:00
2020-08-23 17:36:59 -05:00
2019-06-12 20:28:11 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-08-23 17:36:59 -05:00
2019-04-01 17:46:59 +02:00
2020-09-08 13:33:02 +02:00
2019-12-05 10:57:53 +02:00
2020-09-08 13:33:03 +02:00
2020-09-08 13:33:24 +02:00
2020-10-15 08:12:59 +02:00
2020-08-23 17:36:59 -05:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2019-12-05 10:57:53 +02:00
2020-08-23 17:36:59 -05:00
2020-09-08 13:33:25 +02:00
2019-12-05 10:57:53 +02:00
2020-01-30 08:04:01 -08:00
2021-03-07 12:34:04 +01:00
2020-06-21 09:58:55 +02:00
2020-05-06 21:04:45 +02:00
2019-05-30 11:26:32 -07:00
2020-04-17 15:50:14 +02:00
2019-12-05 10:57:53 +02:00
2020-09-14 18:11:40 +02:00
2020-04-17 15:50:08 +02:00
2019-06-05 17:36:37 +02:00
2020-09-08 13:33:18 +02:00
2020-05-06 20:22:25 +02:00
2019-06-19 17:09:55 +02:00
2019-06-05 17:36:37 +02:00
2020-03-02 16:32:04 +01:00
2019-06-05 17:36:37 +02:00
2020-08-23 17:36:59 -05:00
2019-12-05 10:57:53 +02:00