Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/exynos: dp: Fix NULL pointer dereference due uninitialized connector

Commit 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to
bridge directory") split the Exynos DP core driver into a core driver and
a bridge driver for the Analogix chip since that is also used by Rockchip.

But the change introduced a regression causing a NULL pointer dereference
when trying to access an uninitialized connector in the driver .get_modes:

Fix this by instead of having a connector struct for both the Exynos and
Analogix drivers, just use the connector initialized in the bridge driver.

Fixes: 3424e3a4f844 ("drm: bridge: analogix/dp: split exynos dp driver to bridge directory")

Reported-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>

authored by

Yakir Yang and committed by
Inki Dae
d90efc9e 0ab15bde

+3 -2
+3 -2
drivers/gpu/drm/exynos/exynos_dp.c
··· 34 34 35 35 struct exynos_dp_device { 36 36 struct drm_encoder encoder; 37 - struct drm_connector connector; 37 + struct drm_connector *connector; 38 38 struct drm_bridge *ptn_bridge; 39 39 struct drm_device *drm_dev; 40 40 struct device *dev; ··· 70 70 static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data) 71 71 { 72 72 struct exynos_dp_device *dp = to_dp(plat_data); 73 - struct drm_connector *connector = &dp->connector; 73 + struct drm_connector *connector = dp->connector; 74 74 struct drm_display_mode *mode; 75 75 int num_modes = 0; 76 76 ··· 103 103 int ret; 104 104 105 105 drm_connector_register(connector); 106 + dp->connector = connector; 106 107 107 108 /* Pre-empt DP connector creation if there's a bridge */ 108 109 if (dp->ptn_bridge) {