From 322e50ae8ceb5a218fbe0a4845715627058b3c1d Mon Sep 17 00:00:00 2001 From: Rajkumar Subbiah Date: Thu, 9 Jul 2020 21:03:50 -0400 Subject: [PATCH] disp: msm: dp: check branch device when adding mst sim port When adding a new MST sim port check if the branch device was destroyed already to avoid dereferencing a null pointer. Change-Id: I8e6f82c5a6772a9b85d24feca52368da2027e96d Signed-off-by: Rajkumar Subbiah --- msm/dp/dp_mst_drm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/msm/dp/dp_mst_drm.c b/msm/dp/dp_mst_drm.c index 922acfada8..e60de03519 100644 --- a/msm/dp/dp_mst_drm.c +++ b/msm/dp/dp_mst_drm.c @@ -267,6 +267,10 @@ static void dp_mst_sim_add_port(struct dp_mst_private *mst, struct drm_dp_mst_port *port; mstb = mst->mst_mgr.mst_primary; + if (!mstb) { + DP_ERR("Unable to add port. mst branch device was destroyed\n"); + return; + } port = kzalloc(sizeof(*port), GFP_KERNEL); if (!port)