From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6C5FFBF0 for ; Mon, 15 May 2023 16:56:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B1B2C433EF; Mon, 15 May 2023 16:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1684169787; bh=zlfmBqNfLI6nFzxmNcngerFzuFKfYe+Gi2PP/BZxpNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gGCU1+zrour5waYfYozcus2xSi6XpxP/bTWoFcmldx/3b7nBZH43WkSMs9ItBEwOM SHF4FM2GrlPHdGLyYhM+I9+SeH955lKUsh6RPUuR+akMHDuF8jST6OiNU9YgBWAXa8 70clwbhRAJdSi/Gn5FQkMv/8ijIxBFWMaZzCPPyQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abhinav Kumar , Johan Hovold , Dmitry Baryshkov Subject: [PATCH 6.3 170/246] drm/msm: fix NULL-deref on snapshot tear down Date: Mon, 15 May 2023 18:26:22 +0200 Message-Id: <20230515161727.732105584@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230515161722.610123835@linuxfoundation.org> References: <20230515161722.610123835@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Johan Hovold commit a465353b9250802f87b97123e33a17f51277f0b1 upstream. In case of early initialisation errors and on platforms that do not use the DPU controller, the deinitilisation code can be called with the kms pointer set to NULL. Fixes: 98659487b845 ("drm/msm: add support to take dpu snapshot") Cc: stable@vger.kernel.org # 5.14 Cc: Abhinav Kumar Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/525099/ Link: https://lore.kernel.org/r/20230306100722.28485-4-johan+linaro@kernel.org Signed-off-by: Dmitry Baryshkov Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/msm/msm_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -242,7 +242,8 @@ static int msm_drm_uninit(struct device msm_fbdev_free(ddev); #endif - msm_disp_snapshot_destroy(ddev); + if (kms) + msm_disp_snapshot_destroy(ddev); drm_mode_config_cleanup(ddev);