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

Commit aee5aeb2 authored by Govinda Rajulu Chenna's avatar Govinda Rajulu Chenna Committed by Gerrit - the friendly Code Review server
Browse files

drm/msm/dp: avoid mst_hpd_irq process before mst session start



Processing mst_hpd_irq before mst session start, that is mst_hpd,
leads in accessing uninitialized mst data structures. This change
verifies the mst session start state before processing mst_hpd_irq.

CRs-Fixed: 2372565
Change-Id: I75f568ca05a8f0d80c7a4fe890013c374baf3c15
Signed-off-by: default avatarGovinda Rajulu Chenna <gchenna@codeaurora.org>
parent 69e70152
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -123,6 +123,7 @@ struct dp_mst_private {
	struct dp_mst_sim_mode simulator;
	struct mutex mst_lock;
	enum dp_drv_state state;
	bool mst_session_state;
};

struct dp_mst_encoder_info_cache {
@@ -1473,6 +1474,10 @@ static void dp_mst_display_hpd(void *dp_display, bool hpd_status,
	struct dp_display *dp = dp_display;
	struct dp_mst_private *mst = dp->dp_mst_prv_info;

	mutex_lock(&mst->mst_lock);
	mst->mst_session_state = hpd_status;
	mutex_unlock(&mst->mst_lock);

	if (!hpd_status)
		rc = mst->mst_fw_cbs->topology_mgr_set_mst(&mst->mst_mgr,
				hpd_status);
@@ -1511,6 +1516,11 @@ static void dp_mst_display_hpd_irq(void *dp_display,
		return;
	}

	if (!mst->mst_session_state) {
		pr_err("mst_hpd_irq received before mst session start\n");
		return;
	}

	rc = drm_dp_dpcd_read(mst->caps.drm_aux, DP_SINK_COUNT_ESI,
		esi, 14);
	if (rc != 14) {