Thomas Zimmermann
31f351eb53
drm/aperture: Run fbdev removal before internal helpers
commit bf43e4521f upstream.
Always run fbdev removal first to remove simpledrm via
sysfb_disable(). This clears the internal state. The later call
to drm_aperture_detach_drivers() then does nothing. Otherwise,
with drm_aperture_detach_drivers() running first, the call to
sysfb_disable() uses inconsistent state.
Example backtrace show below:
[ 11.663422] ==================================================================
[ 11.663426] BUG: KASAN: use-after-free in device_del+0x79/0x5f0
[ 11.663435] Read of size 8 at addr ffff888108185050 by task systemd-udevd/311
[ 11.663440] CPU: 0 PID: 311 Comm: systemd-udevd Tainted: G E 5
.19.0-rc2-1-default+ #1689
[ 11.663445] Hardware name: HP ProLiant DL120 G7, BIOS J01 04/21/2011
[ 11.663447] Call Trace:
[ 11.663449] <TASK>
[ 11.663451] ? device_del+0x79/0x5f0
[ 11.663456] dump_stack_lvl+0x5b/0x73
[ 11.663462] print_address_description.constprop.0+0x1f/0x1b0
[ 11.663468] ? device_del+0x79/0x5f0
[ 11.663471] ? device_del+0x79/0x5f0
[ 11.663475] print_report.cold+0x3c/0x21c
[ 11.663481] ? lock_acquired+0x87/0x1e0
[ 11.663484] ? lock_acquired+0x87/0x1e0
[ 11.663489] ? device_del+0x79/0x5f0
[ 11.663492] kasan_report+0xbf/0xf0
[ 11.663498] ? device_del+0x79/0x5f0
[ 11.663503] device_del+0x79/0x5f0
[ 11.663509] ? device_remove_attrs+0x170/0x170
[ 11.663514] ? lock_is_held_type+0xe8/0x140
[ 11.663523] platform_device_del.part.0+0x19/0xe0
[ 11.663530] platform_device_unregister+0x1c/0x30
[ 11.663535] sysfb_disable+0x2d/0x70
[ 11.663540] remove_conflicting_framebuffers+0x1c/0xf0
[ 11.663546] remove_conflicting_pci_framebuffers+0x130/0x1a0
[ 11.663554] drm_aperture_remove_conflicting_pci_framebuffers+0x86/0xb0
[ 11.663561] ? mgag200_pci_remove+0x30/0x30 [mgag200]
[ 11.663578] mgag200_pci_probe+0x2d/0x140 [mgag200]
Reported-by: Zack Rusin <zackr@vmware.com>
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Zack Rusin <zackr@vmware.com>
Fixes: ee7a69aa38 ("fbdev: Disable sysfb device registration when removing conflicting FBs")
Cc: Javier Martinez Canillas <javierm@redhat.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Zhen Lei <thunder.leizhen@huawei.com>
Cc: Changcheng Deng <deng.changcheng@zte.com.cn>
Link: https://patchwork.freedesktop.org/patch/msgid/20220617121027.30273-1-tzimmermann@suse.de
(cherry picked from commit fb84efa28a)
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-07-21 21:24:44 +02:00
..
2022-07-21 21:24:29 +02:00
2022-06-09 10:22:46 +02:00
2022-05-01 17:22:28 +02:00
2021-12-01 09:04:47 +01:00
2022-06-14 18:36:27 +02:00
2021-08-10 20:00:58 +02:00
2022-06-14 18:36:27 +02:00
2022-06-09 10:23:24 +02:00
2021-09-16 14:05:07 +09:00
2021-08-10 20:13:25 +02:00
2022-06-09 10:23:29 +02:00
2021-08-08 20:27:24 +02:00
2021-07-30 14:52:00 +10:00
2021-12-01 09:04:51 +01:00
2021-08-10 20:14:01 +02:00
2022-07-21 21:24:25 +02:00
2022-06-14 18:36:19 +02:00
2021-08-11 15:49:15 +02:00
2022-02-08 18:34:09 +01:00
2022-01-27 11:04:23 +01:00
2021-07-30 14:52:00 +10:00
2022-07-12 16:35:07 +02:00
2022-04-08 14:23:23 +02:00
2021-08-10 20:14:01 +02:00
2022-04-08 14:23:00 +02:00
2022-07-07 17:53:33 +02:00
2022-03-08 19:12:40 +01:00
2022-06-09 10:23:25 +02:00
2021-07-28 16:33:12 +03:00
2022-06-09 10:22:53 +02:00
2022-07-21 21:24:13 +02:00
2021-07-31 20:52:01 +02:00
2021-07-21 11:58:28 +10:00
2021-10-15 15:05:10 +10:00
2022-06-14 18:36:23 +02:00
2022-01-27 11:04:35 +01:00
2022-06-09 10:22:53 +02:00
2021-07-01 08:53:25 +02:00
2022-04-08 14:23:24 +02:00
2021-07-25 11:01:12 +02:00
2021-07-28 16:33:12 +03:00
2022-06-09 10:23:28 +02:00
2022-06-29 09:03:22 +02:00
2022-04-08 14:23:35 +02:00
2021-08-10 20:13:49 +02:00
2022-06-09 10:23:29 +02:00
2022-04-08 14:22:56 +02:00
2022-01-27 11:03:01 +01:00
2021-06-24 15:40:11 +02:00
2021-11-25 09:49:05 +01:00
2022-06-09 10:22:51 +02:00
2022-01-27 11:03:13 +01:00
2022-06-09 10:22:45 +02:00
2021-07-13 13:15:52 +02:00
2021-08-10 20:14:01 +02:00
2022-06-09 10:22:30 +02:00
2021-08-08 20:27:52 +02:00
2022-06-09 10:22:44 +02:00
2021-06-24 15:40:11 +02:00
2021-08-09 02:28:05 +03:00
2021-06-29 15:40:53 +02:00
2022-07-21 21:24:44 +02:00
2022-06-14 18:36:27 +02:00
2022-02-23 12:03:08 +01:00
2022-02-01 17:27:01 +01:00
2021-08-05 12:08:15 +02:00
2022-06-09 10:22:44 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2022-03-19 13:47:49 +01:00
2021-07-27 12:48:17 +02:00
2021-08-02 10:19:43 +02:00
2021-06-10 19:14:47 +02:00
2021-07-20 20:14:42 +02:00
2021-08-11 08:47:08 +10:00
2022-01-27 11:03:13 +01:00
2022-05-25 09:57:28 +02:00
2022-01-27 11:03:01 +01:00
2021-08-02 10:19:43 +02:00
2022-06-09 10:22:44 +02:00
2021-05-25 11:42:09 +01:00
2022-04-08 14:23:03 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-06-04 06:13:57 +10:00
2021-08-02 10:19:43 +02:00
2021-08-08 20:26:16 +02:00
2022-02-23 12:03:09 +01:00
2021-08-08 20:26:16 +02:00
2021-08-02 10:19:43 +02:00
2021-06-02 11:07:25 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-17 13:56:03 -04:00
2021-08-02 10:19:43 +02:00
2021-08-10 20:14:01 +02:00
2021-07-30 11:55:41 +02:00
2021-08-10 20:14:01 +02:00
2021-07-23 20:17:59 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-07-15 10:54:04 +01:00
2022-04-13 20:59:00 +02:00
2021-07-13 06:38:37 -07:00
2021-11-18 19:17:00 +01:00
2022-06-09 10:22:34 +02:00
2021-11-25 09:49:05 +01:00
2021-08-19 09:02:55 +09:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-02 10:19:43 +02:00
2021-08-08 20:14:08 +02:00
2022-04-08 14:23:03 +02:00
2021-08-10 20:14:01 +02:00
2021-08-02 10:19:43 +02:00
2021-11-21 13:44:12 +01:00
2021-07-05 08:54:44 +02:00