Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d6ead2d3 authored by Steve Cohen's avatar Steve Cohen
Browse files

drm/msm: initialize mode_config functions before HW init



The DRM framework in 4.14 has been updated to take special actions
if the sub-driver implements the atomic commit callback.  During the
hw init, there is a code path that leads to this check.  This can
lead to a null pointer dereference if the mode_config functions
are not initialized beforehand.

Change-Id: Ic036870c2db49ae3a086bfc0e1a959575b8e0254
Signed-off-by: default avatarSteve Cohen <cohens@codeaurora.org>
parent d9565e9b
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -656,6 +656,15 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
	priv->kms = kms;
	pm_runtime_enable(dev);

	/**
	 * Since kms->funcs->hw_init(kms) might call
	 * drm_object_property_set_value to initialize some custom
	 * properties we need to make sure mode_config.funcs are populated
	 * beforehand to avoid dereferencing an unset value during the
	 * drm_drv_uses_atomic_modeset check.
	 */
	ddev->mode_config.funcs = &mode_config_funcs;

	if (kms) {
		ret = kms->funcs->hw_init(kms);
		if (ret) {
@@ -663,7 +672,6 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
			goto fail;
		}
	}
	ddev->mode_config.funcs = &mode_config_funcs;

	/**
	 * this priority was found during empiric testing to have appropriate