]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/amd/display: Handle null 'stream_status' in 'planes_changed_for_existing_stream'
authorSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Fri, 26 Jul 2024 14:01:55 +0000 (19:31 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Oct 2024 10:00:30 +0000 (12:00 +0200)
[ 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 <chiahsuan.chung@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/dc/core/dc_resource.c

index 786b56e96a81625e2b0427803385a6f0afecf8a6..7462c34793799f7ff03b29b198828c560de5f8a9 100644 (file)
@@ -3662,8 +3662,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)