Shang XiaoJing
1d160dfb3f
drm: Fix potential null-ptr-deref in drm_vblank_destroy_worker()
[ Upstream commit 4979524f5a2a8210e87fde2f642b0dc060860821 ]
drm_vblank_init() call drmm_add_action_or_reset() with
drm_vblank_init_release() as action. If __drmm_add_action() failed, will
directly call drm_vblank_init_release() with the vblank whose worker is
NULL. As the resule, a null-ptr-deref will happen in
kthread_destroy_worker(). Add the NULL check before calling
drm_vblank_destroy_worker().
BUG: null-ptr-deref
KASAN: null-ptr-deref in range [0x0000000000000068-0x000000000000006f]
CPU: 5 PID: 961 Comm: modprobe Not tainted 6.0.0-11331-gd465bff130bf-dirty
RIP: 0010:kthread_destroy_worker+0x25/0xb0
Call Trace:
<TASK>
drm_vblank_init_release+0x124/0x220 [drm]
? drm_crtc_vblank_restore+0x8b0/0x8b0 [drm]
__drmm_add_action_or_reset+0x41/0x50 [drm]
drm_vblank_init+0x282/0x310 [drm]
vkms_init+0x35f/0x1000 [vkms]
? 0xffffffffc4508000
? lock_is_held_type+0xd7/0x130
? __kmem_cache_alloc_node+0x1c2/0x2b0
? lock_is_held_type+0xd7/0x130
? 0xffffffffc4508000
do_one_initcall+0xd0/0x4f0
...
do_syscall_64+0x35/0x80
entry_SYSCALL_64_after_hwframe+0x46/0xb0
Fixes: 5e6c2b4f91 ("drm/vblank: Add vblank works")
Signed-off-by: Shang XiaoJing <shangxiaojing@huawei.com>
Reviewed-by: Lyude Paul <lyude@redhat.com>
Signed-off-by: Lyude Paul <lyude@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221101070716.9189-3-shangxiaojing@huawei.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-11-25 17:45:44 +01:00
..
2022-11-25 17:45:41 +01:00
2020-06-10 09:02:03 +02:00
2022-06-09 10:21:01 +02:00
2020-09-23 09:52:24 +10:00
2020-12-30 11:52:56 +01:00
2021-12-22 09:30:54 +01:00
2020-07-02 20:25:51 +02:00
2020-08-11 11:58:31 +10:00
2022-10-26 13:25:49 +02:00
2022-06-09 10:21:24 +02:00
2022-08-21 15:15:46 +02:00
2020-09-08 14:41:40 +10:00
2022-09-28 11:10:39 +02:00
2022-09-28 11:10:33 +02:00
2020-08-06 14:27:31 -07:00
2020-09-11 10:54:17 +02:00
2022-11-16 09:57:16 +01:00
2022-11-25 17:45:40 +01:00
2022-06-09 10:21:00 +02:00
2022-01-27 10:54:10 +01:00
2022-08-21 15:15:41 +02:00
2022-09-28 11:10:36 +02:00
2022-10-26 13:25:49 +02:00
2022-04-08 14:39:56 +02:00
2022-11-10 18:14:20 +01:00
2021-10-27 09:56:54 +02:00
2022-10-26 13:25:48 +02:00
2022-10-26 13:25:26 +02:00
2022-11-25 17:45:44 +01:00
2022-07-21 21:20:01 +02:00
2022-10-26 13:25:24 +02:00
2021-07-14 16:56:20 +02:00
2022-09-15 11:32:03 +02:00
2022-01-27 10:54:14 +01:00
2022-11-10 18:14:29 +01:00
2020-08-23 17:36:59 -05:00
2021-07-19 09:44:40 +02:00
2020-09-01 13:02:33 +05:30
2020-06-10 09:05:18 +02:00
2020-09-08 14:41:40 +10:00
2022-06-09 10:21:27 +02:00
2022-08-25 11:38:11 +02:00
2022-04-08 14:40:18 +02:00
2020-08-21 15:17:05 +03:00
2022-06-09 10:21:28 +02:00
2022-08-21 15:15:38 +02:00
2022-01-27 10:53:44 +01:00
2020-12-30 11:52:56 +01:00
2022-10-26 13:25:10 +02:00
2021-11-18 14:04:02 +01:00
2022-01-27 10:53:49 +01:00
2022-11-16 09:57:11 +01:00
2020-09-11 10:47:19 +02:00
2020-08-23 17:36:59 -05:00
2022-10-30 09:41:18 +01:00
2021-05-11 14:47:26 +02:00
2022-05-18 10:23:47 +02:00
2021-04-21 13:00:52 +02:00
2021-09-18 13:40:27 +02:00
2021-07-19 09:44:36 +02:00
2022-06-14 18:32:46 +02:00
2020-07-02 20:25:51 +02:00
2020-07-02 15:26:00 +02:00
2020-07-02 15:26:00 +02:00
2021-09-18 13:40:19 +02:00
2020-05-14 02:10:52 +03:00
2020-08-26 19:11:41 +02:00
2022-10-26 13:25:24 +02:00
2020-08-23 17:36:59 -05:00
2020-09-10 08:17:48 +02:00
2020-05-27 14:31:42 +03:00
2020-05-26 13:31:01 +02:00
2020-08-17 13:41:50 -04:00
2022-03-19 13:44:45 +01:00
2022-07-02 16:39:23 +02:00
2020-07-02 15:26:00 +02:00
2020-08-25 11:00:02 +02:00
2020-09-01 09:45:44 +02:00
2021-09-18 13:40:19 +02:00
2020-12-30 11:54:19 +01:00
2022-10-26 13:25:50 +02:00
2022-10-26 13:25:24 +02:00
2022-11-25 17:45:44 +01:00
2022-06-09 10:20:59 +02:00
2020-06-19 09:20:21 +02:00
2022-07-02 16:39:23 +02:00
2021-09-18 13:40:19 +02:00
2020-05-26 13:33:08 +02:00
2020-06-19 13:33:40 +01:00
2020-09-09 11:45:18 +02:00
2020-09-10 08:17:48 +02:00
2020-05-19 22:31:31 +01:00
2021-03-17 17:06:19 +01:00
2020-09-08 10:43:30 +02:00
2020-11-20 05:20:48 +10:00
2022-09-15 11:32:02 +02:00
2020-05-05 14:01:53 -04:00
2022-11-25 17:45:44 +01:00
2021-09-03 10:09:27 +02:00
2022-10-26 13:25:48 +02:00
2020-05-29 12:58:11 +02:00
2022-07-02 16:39:23 +02:00
2021-09-18 13:40:19 +02:00
2020-07-02 15:26:00 +02:00
2020-09-21 10:45:08 +02:00
2022-08-21 15:15:38 +02:00
2022-10-26 13:25:24 +02:00
2020-06-23 15:46:40 +02:00
2020-07-02 15:26:00 +02:00
2020-08-17 13:41:50 -04:00
2021-09-30 10:11:04 +02:00
2021-09-15 09:50:32 +02:00
2022-10-26 13:25:49 +02:00
2020-08-16 17:12:18 +02:00
2020-07-02 15:26:00 +02:00
2021-11-18 14:04:22 +01:00
2022-06-09 10:20:52 +02:00
2022-09-15 11:32:02 +02:00
2021-05-14 09:50:23 +02:00
2020-06-02 10:59:11 -07:00
2021-12-14 11:32:39 +01:00
2020-06-03 10:24:23 +02:00
2020-08-06 11:55:43 -07:00
2020-09-14 22:37:31 +03:00
2020-06-24 15:45:51 +10:00
2020-05-20 20:03:45 +02:00
2022-10-26 13:25:25 +02:00
2020-09-09 16:39:48 +02:00