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 C45DA206F35; Fri, 6 Dec 2024 14:51:41 +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=1733496701; cv=none; b=dNRpbyKKmjY3dbSpz26Lh+8UA4plso7vnQRvpwPdIGJaCTRkllAcOOkgQ19n5xnCryizbGFtmUANPv5SgrIpeKMKKSL1+2e/MS5zoGV4shi/Fi4GoPus396zGVtij9PqwFEOvfMIHDmh+WaG2uddOE8ZZ+Xv8KQtChtc91N5eg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733496701; c=relaxed/simple; bh=eUh5xHWr+unoHSCvskLv934g4waWWSl/sBOuR0QQI+A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QwfFWUYnNr5k4R+JYu9xkRx3jOxFGfzmCHzYFbaBYfhHoS7aTJI+9zSUWjgeQ9knrY+mPdrRdNzFyoGGy2q2seCAJRew4fziYQvF0I11dyl7Q0bQhtqznYze9Q0MnAS2FiUlBKfb6YoRB9SJHSt8uAVhzJRFb0G7/yF+lXnKVRM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=yRoikl1Q; 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="yRoikl1Q" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18310C4CEDE; Fri, 6 Dec 2024 14:51:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733496701; bh=eUh5xHWr+unoHSCvskLv934g4waWWSl/sBOuR0QQI+A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yRoikl1Qz2/zbtKms7tIbcZKb268gmRmVun3LJOR2/X98sYzcRtsQ6rG48xSBHJkP N5mKLUFM955kquhI3y5VuhmK342WeLktfQYL4jLau4Lmdlgu0Eq46QsS8z/87Wv2c/ d6ou1TM0JEL/Ww4DkEOS0yUsajuwUdUfmMDxZqbI= 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.6 038/676] drm/amd/display: Add NULL check for function pointer in dcn32_set_output_transfer_func Date: Fri, 6 Dec 2024 15:27:37 +0100 Message-ID: <20241206143654.843889172@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241206143653.344873888@linuxfoundation.org> References: <20241206143653.344873888@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.6-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 650e1598bddcb..2289c17f6ead5 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_hwseq.c @@ -587,7 +587,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