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 2CB5F2210F2; Thu, 12 Dec 2024 15:55:04 +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=1734018904; cv=none; b=P9TLb10XjG7xtTPLrCk+UuyL/zK7OlxnuFdJzDVG7gMDot+NFNNBDKqVE+ET/+F1AGsxfcNt6wc2QlneaJSoEKjIsrxDTnPA5oqTgYpmO0LIWNCp4h686YrU9Al1BoR9VnqUl1jLF004jx3Xgkhrccr5QXS2QAZWvB2Bz1yEALw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734018904; c=relaxed/simple; bh=v3ZDhB6Jn5rXWFIFFebdlve2Yb0P1ltkSykkNzAZPOM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gdlS32JkysXm9Zr6f6aN1QUfjlj+ZhZ2+d6gjmkPlUKdWQ7nqkqcYCrQKecgO0S5e0a2FpSuBAS27iATr6v8MUZbM64Pg7JTc8ZRfw95PN+yfeFFaGmU0KoovDV3k5sDtTL+InNXaiIbXT3ilFvPTl+hD7ogSoUmW6tjqBCpS4U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=T33Ko2Ru; 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="T33Ko2Ru" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41FCFC4CECE; Thu, 12 Dec 2024 15:55:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734018904; bh=v3ZDhB6Jn5rXWFIFFebdlve2Yb0P1ltkSykkNzAZPOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T33Ko2RuKpLvHfYm6sBgBrIsaMcTOMcnIuYL2FC61ETYOBSyD3fTiL1uOjTlOVIlC fXvDhEtC/xTHGYTuIamksK1cretPHfRbC7wWZkJ9LxQ2AIQ7ZJJK6Bt+5t5dLrQpk3 4wPS45EEA7GLBU2VeO5DzMVqYefVbXyxLIryARBs= 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 , Xiangyu Chen , Sasha Levin Subject: [PATCH 6.1 036/772] drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func Date: Thu, 12 Dec 2024 15:49:41 +0100 Message-ID: <20241212144351.432522236@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144349.797589255@linuxfoundation.org> References: <20241212144349.797589255@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.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Srinivasan Shanmugam [ Upstream commit 28574b08c70e56d34d6f6379326a860b96749051 ] This commit adds a null check for the set_output_gamma function pointer in the dcn32_set_output_transfer_func function. Previously, set_output_gamma was being checked for null, but then it was being dereferenced without any null check. This could lead to a null pointer dereference if set_output_gamma is null. To fix this, we now ensure that set_output_gamma is not null before dereferencing it. We do this by adding a null check for set_output_gamma before the call to set_output_gamma. 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: Xiangyu Chen Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c index bd75d3cba0980..d3ad13bf35c85 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c @@ -667,7 +667,9 @@ bool dcn32_set_output_transfer_func(struct dc *dc, } } - mpc->funcs->set_output_gamma(mpc, mpcc_id, params); + if (mpc->funcs->set_output_gamma) + mpc->funcs->set_output_gamma(mpc, mpcc_id, params); + return ret; } -- 2.43.0