From nobody Sun Nov 24 12:45:19 2024 Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) (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 078331D5AB2 for ; Tue, 5 Nov 2024 14:12:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.32 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815970; cv=none; b=WdQGclVw8LwQ8n5ZmoVVKkbspV0l32lbQLkTXNNGlcGw9FNzYhHkh41DCdmMGr1NF3RCt7TlndTP6zICezv4MnZWXopEhZmwIBcKYoKwPN1hmUq2Fp9vq2oP5JSNEqAuoCvftGaXgs7QjemLejscoEoI6ZK4Besdq7aDXAeYlXs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815970; c=relaxed/simple; bh=3ARecU0HmFg8QXgNQwLuBzW3IAx4FalzghCZYRWGTtU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oEnk2Cdo1cLd3bORH+c6FVS34L7zbCtIAmQrDjQLTboFu+TmnjIzZ3/zI7EDE0Re/zxp91fUTSWHf62V6Keq99QNwXnMuUn9Cr6vC0dgsTvnmqQ6HUG16MmBuUOl10Xz+D9ILo70szCpLXv5PX4C3CX0/AqEH54w77PIKKGeLwc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4XjVfT4mnlz1ypGn; Tue, 5 Nov 2024 22:12:49 +0800 (CST) Received: from kwepemd200012.china.huawei.com (unknown [7.221.188.145]) by mail.maildlp.com (Postfix) with ESMTPS id B27391402E2; Tue, 5 Nov 2024 22:12:39 +0800 (CST) Received: from huawei.com (10.67.175.84) by kwepemd200012.china.huawei.com (7.221.188.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Tue, 5 Nov 2024 22:12:38 +0800 From: Zicheng Qu To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH 1/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in dcn20_program_pipe Date: Tue, 5 Nov 2024 14:01:36 +0000 Message-ID: <20241105140137.2465572-2-quzicheng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105140137.2465572-1-quzicheng@huawei.com> References: <20241105140137.2465572-1-quzicheng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd200012.china.huawei.com (7.221.188.145) Content-Type: text/plain; charset="utf-8" This commit addresses a null pointer dereference issue in dcn20_program_pipe(). Previously, commit 8e4ed3cf1642 ("drm/amd/display: Add null check for pipe_ctx->plane_state in dcn20_program_pipe") partially fixed the null pointer dereference issue. However, in dcn20_update_dchubp_dpp(), the variable pipe_ctx is passed in, and plane_state is accessed again through pipe_ctx. Multiple if statements directly call attributes of plane_state, leading to potential null pointer dereference issues. This patch adds necessary null checks to ensure stability. Fixes: 8e4ed3cf1642 ("drm/amd/display: Add null check for pipe_ctx->plane_s= tate in dcn20_program_pipe") Signed-off-by: Zicheng Qu Reviewed-by: Tom Chung --- drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c b/driv= ers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c index a80c08582932..36d12db8d022 100644 --- a/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c +++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn20/dcn20_hwseq.c @@ -1923,9 +1923,9 @@ static void dcn20_program_pipe( dc->res_pool->hubbub, pipe_ctx->plane_res.hubp->inst, pipe_ctx->hubp_r= egs.det_size); } =20 - if (pipe_ctx->update_flags.raw || - (pipe_ctx->plane_state && pipe_ctx->plane_state->update_flags.raw) || - pipe_ctx->stream->update_flags.raw) + if (pipe_ctx->plane_state && (pipe_ctx->update_flags.raw || + pipe_ctx->plane_state->update_flags.raw || + pipe_ctx->stream->update_flags.raw)) dcn20_update_dchubp_dpp(dc, pipe_ctx, context); =20 if (pipe_ctx->plane_state && (pipe_ctx->update_flags.bits.enable || --=20 2.34.1 From nobody Sun Nov 24 12:45:19 2024 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 CEA3C1D47B4 for ; Tue, 5 Nov 2024 14:12:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815968; cv=none; b=WHB1VbIEDDpSu6GkYS4sHY2UnnipyLcg1BEtLidGlqZlX6jSm6iv/L2wV3yDyWkfR1LnQdW8+nnStE+jBgFEbX2DX2ZfpYJu1PSSuDo39Q+atsjfc6WbBwJr+gM2d5vFDADCUrghl7lC0hrF6U4wyNiJEKOCuveNGqF39UPRUVA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730815968; c=relaxed/simple; bh=SXQEx8fLTQsUgzN0AAypKZL3KqcCpTPfY8ymUkX3iL0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lD97gQ9I61is8PWUblnlieLg8Df3YedOQcxp++d9B6809KukcFtnbs+AduCME24eFJRTexdqxzk0P0bFoU/n71rgkLvJkjyUkKIJcAZXwbhlhqHW/baHWUxHEEbMIEXzDaBCwCuDEbOnebcjJblOO2LAe54Xefv7Rw9OqFUxrmk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4XjVcN6z18z1jwR8; Tue, 5 Nov 2024 22:11:00 +0800 (CST) Received: from kwepemd200012.china.huawei.com (unknown [7.221.188.145]) by mail.maildlp.com (Postfix) with ESMTPS id B966F18001B; Tue, 5 Nov 2024 22:12:40 +0800 (CST) Received: from huawei.com (10.67.175.84) by kwepemd200012.china.huawei.com (7.221.188.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Tue, 5 Nov 2024 22:12:39 +0800 From: Zicheng Qu To: , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , Subject: [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp Date: Tue, 5 Nov 2024 14:01:37 +0000 Message-ID: <20241105140137.2465572-3-quzicheng@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241105140137.2465572-1-quzicheng@huawei.com> References: <20241105140137.2465572-1-quzicheng@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd200012.china.huawei.com (7.221.188.145) Content-Type: text/plain; charset="utf-8" This commit addresses a null pointer dereference issue in hwss_setup_dpp(). The issue could occur when pipe_ctx->plane_state is null. The fix adds a check to ensure `pipe_ctx->plane_state` is not null before accessing. This prevents a null pointer dereference. Fixes: 0baae6246307 ("drm/amd/display: Refactor fast update to use new HWSS= build sequence") Signed-off-by: Zicheng Qu Reviewed-by: Tom Chung --- drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c b/driver= s/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c index 7ee2be8f82c4..bb766c2a7417 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c @@ -881,6 +881,9 @@ void hwss_setup_dpp(union block_sequence_params *params) struct dpp *dpp =3D pipe_ctx->plane_res.dpp; struct dc_plane_state *plane_state =3D pipe_ctx->plane_state; =20 + if (!plane_state) + return; + if (dpp && dpp->funcs->dpp_setup) { // program the input csc dpp->funcs->dpp_setup(dpp, --=20 2.34.1