]> git.baikalelectronics.ru Git - kernel.git/commit
drm/omap: fix incorrect union usage
authorSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 21 Nov 2018 16:09:14 +0000 (17:09 +0100)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Mon, 3 Dec 2018 12:46:30 +0000 (14:46 +0200)
commitca4064d52840344e3efbb074f17a5cc4a128b49b
tree3e33feb6471f7e66d1e49d9da797c87a4ca76167
parentbb7371744f5eeb0a26bc9120117a8f4a51a52c6f
drm/omap: fix incorrect union usage

The DSI encoder sets dssdev->ops->dsi.set_config, which is stored at the
same offset as dssdev->ops->hdmi.set_hdmi_mode. The code in omap_encoder
only checks if dssdev->ops->hdmi.set_hdmi_mode is NULL. Due to the way
union works, it won't be NULL if dsi.set_config is set. This means
dsi_set_config will be called with config=hdmi_mode=false=NULL parameter
resulting in a NULL dereference. Also the dereference happens while
console is locked, so kernel hangs without any debug output without
"fb.lockless_register_fb=1" parameter.

This restructures the code, so that the HDMI mode is only configured
for HDMI output types.

Fixes: c1eecb49f5730 ("drm/omap: Move most omap_dss_driver operations to omap_dss_device_ops")
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
Tested-by: Tony Lindgren <tony@atomide.com>
[tomi.valkeinen@ti.com: dropped the safeguard]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181121160916.22017-5-sebastian.reichel@collabora.com
drivers/gpu/drm/omapdrm/omap_encoder.c