6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Allen Pan [ Upstream commit 334b56cea5d9df5989be6cf1a5898114fa70ad98 ] [How] Check wheather state is NULL before releasing it. [ Backport to 6.6.y: implemented the same guard in older dc_release_state() in dc.c rather than dc_state_release() in dc_state.c. ] Cc: Mario Limonciello Cc: Alex Deucher Cc: stable@vger.kernel.org Reviewed-by: Charlene Liu Acked-by: Alex Hung Signed-off-by: Allen Pan Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Assisted-by: LLM Signed-off-by: Artem Dinaburg 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 50b860c07ae01..50df677d509dc 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -2302,7 +2302,8 @@ static void dc_state_free(struct kref *kref) void dc_release_state(struct dc_state *context) { - kref_put(&context->refcount, dc_state_free); + if (context != NULL) + kref_put(&context->refcount, dc_state_free); } bool dc_set_generic_gpio_for_stereo(bool enable, -- 2.53.0