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 5FDA61DE89D; Tue, 8 Oct 2024 12:50:02 +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=1728391802; cv=none; b=WUwZ/vtBywAMy2iEPF6T07TuUPjgl+DcRsn+1Qn1hIC25fYpChY0D9phGx61leMe6CmpItdts1+ZJZEhscz4s56WiYv7YTuZMBCRq8rljUVyd7oPorQdiqfL1EtvGzubhFZBozcv/fsSArm5N6Nry5sGAS0x4eWLIyG6jYcVmFM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391802; c=relaxed/simple; bh=WqQTG/+E+7crHs02fbwkxojTKhRNL96rl4Hn2JZaziU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tCmJxEmJ+U0qZNpsvAFkdqqrNtjYtxfD257Bc+GxNn+7N4QiEshmCTdwQPeVIDZHxBkIiBZhT7aed/SoQOORWyb2cEKdHwo+Vfx84mchEFTGI88DisRAiroXFNriUSjWOPhfMBxlGYJTN/tlBUK8BEfFBs5NCNuooAXRaAE+Sp4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=awv3axiy; 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="awv3axiy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1CA3C4CECC; Tue, 8 Oct 2024 12:50:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391802; bh=WqQTG/+E+7crHs02fbwkxojTKhRNL96rl4Hn2JZaziU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awv3axiyvFOnp81Cr1iCHWPMcHLiAH+aBhEhYD9iFCHKuOAQUCKUS9atd2gzp4Fkl zccGOc9g2uqzwO9PDwbKlqIBuOe9vKVTtEcjExOEkmbgFYsYJ4mlRV1RLG0Xovg2qZ tvaZxeA49cJ84d5ucwlXUZT0O2q1jWbk3qnNaoDc= 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 226/558] drm/amd/display: Add NULL check for function pointer in dcn401_set_output_transfer_func Date: Tue, 8 Oct 2024 14:04:16 +0200 Message-ID: <20241008115711.235693725@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 dd340acd42c24a3f28dd22fae6bf38662334264c ] This commit adds a null check for the set_output_gamma function pointer in the dcn401_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: Sasha Levin --- drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c index 537a24ec74c85..7c724cf682840 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c @@ -748,7 +748,9 @@ bool dcn401_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