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 A5BCC1C57B1; Tue, 15 Oct 2024 12:00:25 +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=1728993625; cv=none; b=UrOOq9675DUrXAtcmvuym2baxYevMSWvJwWCNYJNMBNKyBtvUluq3fzw73aPahCbpf8dj6HAik0MX8JeuWkbjqBUAOiquJUz/gyfqpxa2j6KyngxsjqVUjZrXsoIzKHOsDh7u93/wOdl8sXnaG1gFlOl+/cHByY6SfpRMh8jUHw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728993625; c=relaxed/simple; bh=JW/W2nVAJbBL7gQ2m399ZDylPTOcYEWuXuyXhPY7MWA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=g7oV+gpn6eBjCxKKA88H0kJt3GRZvmSJjSCCUJaO1ZzdO7wbIF20BUit66ufrw8vXPzbK6mf8Kj71DANNKl8/Q7n1bOq/urAJYi0H7O2dXZN385I/pZjRZa3Nf7VJ7F0Jk0f7KzdXYZh0LI9bhiLf//quh2caRPL4Ass6dCF7+Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LqYpubzN; 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="LqYpubzN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0A2FC4CEC6; Tue, 15 Oct 2024 12:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728993625; bh=JW/W2nVAJbBL7gQ2m399ZDylPTOcYEWuXuyXhPY7MWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LqYpubzNA0aRHcdP/MQxD5YiyTSiymn2j67QZB4jjTBC9XpKAYBfAcN0HYR0RUFjU b4XlLgg4gByBw2IiLJFmyUdbx5cM0HHcQgdNhnYwVRNoi8waUp7OfjXZoBRz5U1keo 9SUd9KPai+/xnkCq97YGi1ZT8Yt/+2AMft1aTGBM= 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 5.15 450/691] drm/amd/display: Add null check for top_pipe_to_program in commit_planes_for_stream Date: Tue, 15 Oct 2024 13:26:38 +0200 Message-ID: <20241015112458.208388911@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241015112440.309539031@linuxfoundation.org> References: <20241015112440.309539031@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 5.15-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 12e4beca5e840..22dbc6bc21af4 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -3027,7 +3027,8 @@ static void commit_planes_for_stream(struct dc *dc, dc->hwss.pipe_control_lock(dc, top_pipe_to_program, false); 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