1
0
Fork 0
mirror of synced 2025-03-06 20:59:54 +01:00
linux/drivers/gpu/drm/bridge
Tomi Valkeinen dffdfb8f5d
drm/bridge: sii902x: Fix probing race issue
A null pointer dereference crash has been observed rarely on TI
platforms using sii9022 bridge:

[   53.271356]  sii902x_get_edid+0x34/0x70 [sii902x]
[   53.276066]  sii902x_bridge_get_edid+0x14/0x20 [sii902x]
[   53.281381]  drm_bridge_get_edid+0x20/0x34 [drm]
[   53.286305]  drm_bridge_connector_get_modes+0x8c/0xcc [drm_kms_helper]
[   53.292955]  drm_helper_probe_single_connector_modes+0x190/0x538 [drm_kms_helper]
[   53.300510]  drm_client_modeset_probe+0x1f0/0xbd4 [drm]
[   53.305958]  __drm_fb_helper_initial_config_and_unlock+0x50/0x510 [drm_kms_helper]
[   53.313611]  drm_fb_helper_initial_config+0x48/0x58 [drm_kms_helper]
[   53.320039]  drm_fbdev_dma_client_hotplug+0x84/0xd4 [drm_dma_helper]
[   53.326401]  drm_client_register+0x5c/0xa0 [drm]
[   53.331216]  drm_fbdev_dma_setup+0xc8/0x13c [drm_dma_helper]
[   53.336881]  tidss_probe+0x128/0x264 [tidss]
[   53.341174]  platform_probe+0x68/0xc4
[   53.344841]  really_probe+0x188/0x3c4
[   53.348501]  __driver_probe_device+0x7c/0x16c
[   53.352854]  driver_probe_device+0x3c/0x10c
[   53.357033]  __device_attach_driver+0xbc/0x158
[   53.361472]  bus_for_each_drv+0x88/0xe8
[   53.365303]  __device_attach+0xa0/0x1b4
[   53.369135]  device_initial_probe+0x14/0x20
[   53.373314]  bus_probe_device+0xb0/0xb4
[   53.377145]  deferred_probe_work_func+0xcc/0x124
[   53.381757]  process_one_work+0x1f0/0x518
[   53.385770]  worker_thread+0x1e8/0x3dc
[   53.389519]  kthread+0x11c/0x120
[   53.392750]  ret_from_fork+0x10/0x20

The issue here is as follows:

- tidss probes, but is deferred as sii902x is still missing.
- sii902x starts probing and enters sii902x_init().
- sii902x calls drm_bridge_add(). Now the sii902x bridge is ready from
  DRM's perspective.
- sii902x calls sii902x_audio_codec_init() and
  platform_device_register_data()
- The registration of the audio platform device causes probing of the
  deferred devices.
- tidss probes, which eventually causes sii902x_bridge_get_edid() to be
  called.
- sii902x_bridge_get_edid() tries to use the i2c to read the edid.
  However, the sii902x driver has not set up the i2c part yet, leading
  to the crash.

Fix this by moving the drm_bridge_add() to the end of the
sii902x_init(), which is also at the very end of sii902x_probe().

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Fixes: 21d808405f ("drm/bridge/sii902x: Fix EDID readback")
Reviewed-by: Aradhya Bhatia <a-bhatia1@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240103-si902x-fixes-v1-1-b9fd3e448411@ideasonboard.com
2024-01-23 12:58:06 +01:00
..
adv7511 drm: adv7511: Add hpd_override_enable variable to struct adv7511_chip_info 2023-10-16 11:09:33 +02:00
analogix drm/bridge: anx7625: Fix Set HPD irq detect window to 2ms 2023-11-29 11:10:17 +01:00
cadence drm/bridge: cdns-mhdp8546: Fix use of uninitialized variable 2023-12-07 09:21:44 +02:00
imx drm/bridge: imx93-mipi-dsi: Fix a couple of building warnings 2023-11-28 17:10:30 +01:00
synopsys ASoC: hdmi-codec: drop drm/drm_edid.h include 2024-01-16 16:07:28 +02:00
aux-bridge.c drm/bridge: add transparent bridge helper 2023-12-04 16:07:29 +02:00
aux-hpd-bridge.c drm/bridge: aux-hpd: Replace of_device.h with explicit include 2023-12-07 11:51:01 -06:00
chipone-icn6211.c drm/bridge: icn6211: Convert to use maple tree register cache 2023-10-02 09:09:18 +02:00
chrontel-ch7033.c drm/bridge: fix -Wunused-const-variable= warning 2023-07-31 11:14:24 +02:00
cros-ec-anx7688.c drm: Switch i2c drivers back to use .probe() 2023-05-30 16:55:16 -07:00
display-connector.c drm: Explicitly include correct DT includes 2023-07-21 09:12:43 +02:00
fsl-ldb.c drm: Explicitly include correct DT includes 2023-07-21 09:12:43 +02:00
ite-it6505.c drm/bridge: Fixed a DP link training bug 2024-01-09 18:11:53 +01:00
ite-it66121.c drm: bridge: it66121: ->get_edid callback must not return err pointers 2023-09-15 13:00:08 +02:00
Kconfig drm/bridge: implement generic DP HPD bridge 2023-12-04 16:07:29 +02:00
lontium-lt8912b.c drm/bridge: lt8912b: Add power supplies 2023-12-04 14:00:00 +01:00
lontium-lt9211.c drm/bridge: lt9211: Convert to use maple tree register cache 2023-10-02 09:09:19 +02:00
lontium-lt9611.c ASoC: hdmi-codec: drop drm/drm_edid.h include 2024-01-16 16:07:28 +02:00
lontium-lt9611uxc.c ASoC: hdmi-codec: drop drm/drm_edid.h include 2024-01-16 16:07:28 +02:00
lvds-codec.c drm/bridge: lvds-codec: Implement atomic_get_input_bus_fmts for LVDS encoder 2023-08-11 15:09:59 +02:00
Makefile drm/bridge: implement generic DP HPD bridge 2023-12-04 16:07:29 +02:00
megachips-stdpxxxx-ge-b850v3-fw.c drm/bridge: megachips-stdpxxxx-ge-b850v3-fw: switch to drm_do_get_edid() 2023-10-13 16:28:58 +02:00
nwl-dsi.c drm: Explicitly include correct DT includes 2023-07-21 09:12:43 +02:00
nwl-dsi.h drm/bridge: Add NWL MIPI DSI host controller support 2020-04-09 15:52:47 +02:00
nxp-ptn3460.c drm/bridge: nxp-ptn3460: simplify some error checking 2023-12-06 16:20:23 +01:00
panel.c drm/bridge: panel: Fix device link for DRM_BRIDGE_ATTACH_NO_CONNECTOR 2023-09-20 19:00:38 +02:00
parade-ps8622.c drm: Explicitly include correct DT includes 2023-07-21 09:12:43 +02:00
parade-ps8640.c drm/bridge: ps8640: Drop the ability of ps8640 to fetch the EDID 2023-06-23 17:16:01 +02:00
samsung-dsim.c drm: bridge: samsung-dsim: complete the CLKLANE_STOP setting 2024-01-22 16:08:34 +01:00
sii902x.c drm/bridge: sii902x: Fix probing race issue 2024-01-23 12:58:06 +01:00
sii9234.c drm: Switch i2c drivers back to use .probe() 2023-05-30 16:55:16 -07:00
sil-sii8620.c drm/bridge: fix -Wunused-const-variable= warning 2023-07-31 11:14:24 +02:00
sil-sii8620.h
simple-bridge.c drm: Explicitly include correct DT includes 2023-07-21 09:12:43 +02:00
tc358762.c drm/bridge: tc358762: Handle HS/VS polarity 2023-06-22 11:13:31 +02:00
tc358764.c drm/bridge: tc358764: Use BIT() macro for actual bits 2023-06-22 11:02:58 +02:00
tc358767.c drm/bridge: tc358767: Limit the Pixel PLL input range 2024-01-23 12:18:01 +01:00
tc358768.c drm/bridge: tc358768: Attempt to fix DSI horizontal timings 2023-09-20 13:54:08 +02:00
tc358775.c drm: Switch i2c drivers back to use .probe() 2023-05-30 16:55:16 -07:00
thc63lvd1024.c drm/bridge: thc63lvd1024: Convert to platform remove callback returning void 2023-03-20 11:51:55 +01:00
ti-dlpc3433.c drm/bridge: dpc3433: Convert to use maple tree register cache 2023-10-02 09:09:17 +02:00
ti-sn65dsi83.c drm/bridge: sn65dsi83: Convert to use maple tree register cache 2023-10-02 09:09:20 +02:00
ti-sn65dsi86.c drm/bridge: ti-sn65dsi86: Associate PWM device to auxiliary device 2023-12-11 08:21:54 -08:00
ti-tfp410.c drm/bridge: fix -Wunused-const-variable= warning 2023-07-31 11:14:24 +02:00
ti-tpd12s015.c drm/bridge: tpd12s015: Convert to platform remove callback returning void 2023-11-21 09:17:53 +01:00