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 A945F1C7265; Mon, 14 Oct 2024 15:16:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918963; cv=none; b=DCP34IuHyS+CUSgTJOkXusBpqKrpBI9wvOZ18vM9tPlJWeuTqu9R/DEDjEgOm+JRCd3/jsL0UFIsHnC3FudgaQ6aA3WCtN1bw2D6NfxH/bPcx0LS8WYk5OUq1XAjU9qIs43Pxzcsz3syuo4dpkxBwRLCo1i+xTBGQ58WjAcCEMk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728918963; c=relaxed/simple; bh=DkQiptsGs+80g+pRJyZuqziQ8jglWFawq5NCLYpXV6k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dLvFKgiAk5EVohwaOVa6OmPx4j/ibm42Oc/tsSWVoKuoZ6ldeLc50aYhvq/0+K4zLO+7g6XxsvhLngbJAgJW/N5NnQ5cvEEnkneFYvhkh6CtKDLSxFjfInM52BuUNjdDX919swa3/max08dHpsOCCCoLT876mcJJGTuvO4Up34o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f+uHjSFH; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f+uHjSFH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF369C4CEC3; Mon, 14 Oct 2024 15:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728918963; bh=DkQiptsGs+80g+pRJyZuqziQ8jglWFawq5NCLYpXV6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+uHjSFHNGvsvCe5eHlf8eEHllBZUbaX9WSx7TNGt6/Z/cmJYFdIR5uiQUXyBbBVi xDoPtt+JOaMepXtckRPJcGuIysphHYwO/lRTB9pl0A49Vk4Xj9unsrDQ16HFFJq5xJ qGFjiRziMCjTYmPaFCh+akuaprFKdTEXLdDJQH84= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Tom Chung , Rodrigo Siqueira , Roman Li , Alex Hung , Aurabindo Pillai , Harry Wentland , Hamza Mahfooz , Srinivasan Shanmugam , Alex Deucher , Sasha Levin Subject: [PATCH 6.1 474/798] drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream Date: Mon, 14 Oct 2024 16:17:08 +0200 Message-ID: <20241014141236.597871981@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241014141217.941104064@linuxfoundation.org> References: <20241014141217.941104064@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivasan Shanmugam [ Upstream commit 66d71a72539e173a9b00ca0b1852cbaa5f5bf1ad ] This commit addresses a null pointer dereference issue in the `commit_planes_for_stream` function at line 4140. The issue could occur when `top_pipe_to_program` is null. The fix adds a check to ensure `top_pipe_to_program` is not null before accessing its stream_res. This prevents a null pointer dereference. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:4140 commit_planes_for_stream() error: we previously assumed 'top_pipe_to_program' could be null (see line 3906) Cc: Tom Chung Cc: Rodrigo Siqueira Cc: Roman Li Cc: Alex Hung Cc: Aurabindo Pillai Cc: Harry Wentland Cc: Hamza Mahfooz Signed-off-by: Srinivasan Shanmugam Reviewed-by: Tom Chung Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/core/dc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index d7bca680805d3..b424465238afc 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -3727,7 +3727,8 @@ static void commit_planes_for_stream(struct dc *dc, } if ((update_type != UPDATE_TYPE_FAST) && stream->update_flags.bits.dsc_changed) - if (top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { + if (top_pipe_to_program && + top_pipe_to_program->stream_res.tg->funcs->lock_doublebuffer_enable) { top_pipe_to_program->stream_res.tg->funcs->wait_for_state( top_pipe_to_program->stream_res.tg, CRTC_STATE_VACTIVE); -- 2.43.0