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

Commit 6da86cce authored by Lakshmi Narayana Kalavala's avatar Lakshmi Narayana Kalavala
Browse files

disp: msm: sde: fix null access for wb modes



Writeback modes are passed from DRM driver client and it may provide
invalid configuration. Add null checks for sde_wb_config provided by
client to avoid null access in subsequent calls.

Change-Id: I0924f8907d98e2ecb891cfc0c09191823d9033e8
Signed-off-by: default avatarLakshmi Narayana Kalavala <lkalaval@codeaurora.org>
parent 9d87e36a
Loading
Loading
Loading
Loading
+48 −44
Original line number Diff line number Diff line
@@ -170,7 +170,12 @@ int sde_wb_connector_set_modes(struct sde_wb_device *wb_dev,
	if (connected) {
		SDE_DEBUG("connect\n");

		if (count_modes && modes) {
		if (!count_modes || !modes) {
			SDE_ERROR("invalid count_modes :%u and modes :%d\n",
				count_modes, !modes);
			return -EINVAL;
		}

		modeinfo = kcalloc(count_modes,
				sizeof(struct drm_mode_modeinfo),
				GFP_KERNEL);
@@ -218,7 +223,6 @@ int sde_wb_connector_set_modes(struct sde_wb_device *wb_dev,
				goto error;
			}
		}
		}

		if (wb_dev->modes) {
			wb_dev->count_modes = 0;