Noralf Trønnes
4d4c2d8991
drm/cma-helper: Fix crash in fbdev error path
...
Sergey Suloev reported a crash happening in drm_client_dev_hotplug()
when fbdev had failed to register.
[ 9.124598] vc4_hdmi 3f902000.hdmi: ASoC: Failed to create component debugfs directory
[ 9.147667] vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok
[ 9.155184] vc4_hdmi 3f902000.hdmi: ASoC: no DMI vendor name!
[ 9.166544] vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops [vc4])
[ 9.173840] vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops [vc4])
[ 9.181029] vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops [vc4])
[ 9.188519] vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops [vc4])
[ 9.195690] vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.203523] vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.215032] vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops [vc4])
[ 9.274785] vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops [vc4])
[ 9.290246] [drm] Initialized vc4 0.0.0 20140616 for soc:gpu on minor 0
[ 9.297464] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[ 9.304600] [drm] Driver supports precise vblank timestamp query.
[ 9.382856] vc4-drm soc:gpu: [drm:drm_fb_helper_fbdev_setup [drm_kms_helper]] *ERROR* Failed to set fbdev configuration
[ 10.404937] Unable to handle kernel paging request at virtual address 00330a656369768a
[ 10.441620] [00330a656369768a] address between user and kernel address ranges
[ 10.449087] Internal error: Oops: 96000004 [#1 ] PREEMPT SMP
[ 10.454762] Modules linked in: brcmfmac vc4 drm_kms_helper cfg80211 drm rfkill smsc95xx brcmutil usbnet drm_panel_orientation_quirks raspberrypi_hwmon bcm2835_dma crc32_ce pwm_bcm2835 bcm2835_rng virt_dma rng_core i2c_bcm2835 ip_tables x_tables ipv6
[ 10.477296] CPU: 2 PID: 45 Comm: kworker/2:1 Not tainted 4.19.0-rc5 #3
[ 10.483934] Hardware name: Raspberry Pi 3 Model B Rev 1.2 (DT)
[ 10.489966] Workqueue: events output_poll_execute [drm_kms_helper]
[ 10.596515] Process kworker/2:1 (pid: 45, stack limit = 0x000000007e8924dc)
[ 10.603590] Call trace:
[ 10.606259] drm_client_dev_hotplug+0x5c/0xb0 [drm]
[ 10.611303] drm_kms_helper_hotplug_event+0x30/0x40 [drm_kms_helper]
[ 10.617849] output_poll_execute+0xc4/0x1e0 [drm_kms_helper]
[ 10.623616] process_one_work+0x1c8/0x318
[ 10.627695] worker_thread+0x48/0x428
[ 10.631420] kthread+0xf8/0x128
[ 10.634615] ret_from_fork+0x10/0x18
[ 10.638255] Code: 54000220 f9401261 aa1303e0 b4000141 (f9400c21)
[ 10.644456] ---[ end trace c75b4a4b0e141908 ]---
The reason for this is that drm_fbdev_cma_init() removes the drm_client
when fbdev registration fails, but it doesn't remove the client from the
drm_device client list. So the client list now has a pointer that points
into the unknown and we have a 'use after free' situation.
Split drm_client_new() into drm_client_init() and drm_client_add() to fix
removal in the error path.
Fixes: 894a677f4b3e ("drm/cma-helper: Use the generic fbdev emulation")
Reported-by: Sergey Suloev <ssuloev@orpaltech.com>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181001194536.57756-1-noralf@tronnes.org
2018-10-02 13:03:34 +02:00
..
2018-06-06 08:16:33 -07:00
2017-11-02 11:10:55 +01:00
2018-07-11 22:24:02 +02:00
2018-08-01 17:23:05 -05:00
2018-05-17 10:13:09 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2018-07-07 07:53:09 +02:00
2018-06-20 15:29:18 +01:00
2018-07-17 22:25:48 +02:00
2017-10-25 16:31:29 +10:00
2018-04-16 21:17:29 +02:00
2018-06-21 14:00:06 -07:00
2018-02-13 11:57:59 -05:00
2018-10-02 13:03:34 +02:00
2018-03-16 15:44:01 +02:00
2018-07-13 18:40:27 +02:00
2018-02-16 22:30:06 +01:00
2018-07-13 18:40:28 +02:00
2018-07-06 14:57:03 +02:00
2017-03-24 09:36:06 +01:00
2018-07-10 14:51:37 +02:00
2016-05-23 11:35:31 +10:00
2016-10-19 18:20:40 +03:00
2018-07-13 17:58:19 +03:00
2017-09-11 16:03:57 +03:00
2018-09-18 11:17:06 +02:00
2018-04-24 21:34:53 +02:00
2016-12-18 16:29:29 +05:30
2018-07-02 18:45:55 +03:00
2018-07-10 14:54:50 +02:00
2018-07-10 14:54:09 +02:00
2018-06-20 15:30:20 +01:00
2016-02-05 15:23:48 +10:00
2017-01-25 16:18:57 +01:00
2018-07-18 16:56:45 +01:00
2017-12-20 15:30:17 +01:00
2017-12-04 05:42:49 +10:00
2018-04-24 13:57:22 +02:00
2018-02-16 14:12:48 +00:00
2017-03-24 09:36:06 +01:00
2017-03-24 09:36:06 +01:00
2018-04-16 12:10:48 -04:00
2018-05-03 21:26:32 +02:00
2017-06-01 08:02:14 +02:00
2017-10-25 16:31:30 +10:00
2018-03-28 09:34:12 +03:00
2016-08-24 13:34:00 +02:00
2018-05-24 15:04:30 +01:00
2018-06-21 19:16:07 +03:00
2018-03-19 09:09:46 -04:00
2018-07-13 18:40:27 +02:00
2018-07-13 18:40:27 +02:00
2017-11-30 18:18:08 +01:00
2017-09-13 09:50:52 +02:00
2018-06-27 21:44:04 +02:00
2017-11-02 11:10:55 +01:00
2018-09-27 11:00:42 -04:00
2018-07-05 16:40:00 -05:00
2017-11-02 11:10:55 +01:00
2018-07-03 09:30:19 +02:00
2018-07-13 18:40:28 +02:00
2018-06-20 15:59:34 +02:00
2018-07-30 08:49:41 -04:00
2018-07-13 12:18:03 -04:00
2018-05-04 11:09:54 +02:00
2017-07-31 14:24:14 +02:00
2018-04-24 13:57:22 +02:00
2017-12-15 11:26:52 +01:00
2017-11-02 11:10:55 +01:00
2017-12-04 23:03:21 +01:00
2018-03-01 14:07:22 +10:00
2018-07-13 16:14:04 +01:00
2018-07-07 07:51:19 +02:00
2018-07-13 18:40:27 +02:00
2014-03-17 20:11:57 +01:00
2018-07-31 16:58:20 -05:00
2018-07-17 22:25:19 +02:00
2018-07-10 16:28:47 -07:00
2018-06-18 10:49:57 -07:00
2017-05-03 16:24:00 +03:00
2017-12-12 12:30:22 +02:00
2017-12-07 11:51:56 -05:00