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 3BCC91D54D1; Tue, 8 Oct 2024 12:49:52 +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=1728391792; cv=none; b=NW9tw2bFo3w/IcB6VOmHooGLSBJFqafUYXcxe43J+16TCZZlsNgFEbjlSvwZMf2fKMonFnqqGMzINCGpPmwVhXmjSJm3ZEn8oE1cs98JHUp0ESNiyKu553HIqMPJ+8TzD2c/5nOu0VUvq0H32IjHAkuYkadqfmpwyZf0Ui9g0yU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391792; c=relaxed/simple; bh=DJ0Gbr95sCt6YWcKyOjYkEpSk7HK1snH+d/UnAMY/to=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=COQdkszBKDy/qOmEFdvkFBLSfObdy78hddOzWzvHt4sfILsxUiGRzXUpPPmACpvZMJ+6TPRSqWe5iVhmie7MzC68cy9U0RtV2XRpbGQg3D+DCl9wS0BY4vymVvEPzXKjIzw2vxnljY0yBahNYgjJ/LYUKYF60JjARiw4drlf5ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RoANek2V; 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="RoANek2V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E4F2C4CEC7; Tue, 8 Oct 2024 12:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391792; bh=DJ0Gbr95sCt6YWcKyOjYkEpSk7HK1snH+d/UnAMY/to=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RoANek2Vu6uTzokVwo3Z/NrkIMmpgYCoVQ6V/RUSI82sdGvDpJ+rdNakFu1N6SQ+t KirAdZBgWnnTxLKJsrzUuTH03YakGQlK+xlh8fE1QWX933bd/ws/vEpeFW22qKJbv9 xwc1rGcYHAMKtIu1ln+pu6Nx2CAERJYsGLM04bHU= 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.11 224/558] drm/amd/display: Handle null stream_status in planes_changed_for_existing_stream Date: Tue, 8 Oct 2024 14:04:14 +0200 Message-ID: <20241008115711.157766540@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115702.214071228@linuxfoundation.org> References: <20241008115702.214071228@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivasan Shanmugam [ Upstream commit 8141f21b941710ecebe49220b69822cab3abd23d ] This commit adds a null check for 'stream_status' in the function 'planes_changed_for_existing_stream'. Previously, the code assumed 'stream_status' could be null, but did not handle the case where it was actually null. This could lead to a null pointer dereference. Reported by smatch: drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc_resource.c:3784 planes_changed_for_existing_stream() error: we previously assumed 'stream_status' could be null (see line 3774) 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_resource.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index bcb5267b5a6bc..67794497457d3 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -3771,8 +3771,10 @@ static bool planes_changed_for_existing_stream(struct dc_state *context, } } - if (!stream_status) + if (!stream_status) { ASSERT(0); + return false; + } for (i = 0; i < set_count; i++) if (set[i].stream == stream) -- 2.43.0