[PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp

Zicheng Qu posted 2 patches 2 weeks, 4 days ago
[PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
Posted by Zicheng Qu 2 weeks, 4 days ago
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 <quzicheng@huawei.com>
---
 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/drivers/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 = pipe_ctx->plane_res.dpp;
 	struct dc_plane_state *plane_state = pipe_ctx->plane_state;
 
+	if (!plane_state)
+		return;
+
 	if (dpp && dpp->funcs->dpp_setup) {
 		// program the input csc
 		dpp->funcs->dpp_setup(dpp,
-- 
2.34.1
Re: [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
Posted by Chung, ChiaHsuan (Tom) 1 week, 3 days ago
Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>

On 11/5/2024 10:01 PM, Zicheng Qu wrote:
> 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 <quzicheng@huawei.com>
> ---
>   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/drivers/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 = pipe_ctx->plane_res.dpp;
>   	struct dc_plane_state *plane_state = pipe_ctx->plane_state;
>   
> +	if (!plane_state)
> +		return;
> +
>   	if (dpp && dpp->funcs->dpp_setup) {
>   		// program the input csc
>   		dpp->funcs->dpp_setup(dpp,
Re: [PATCH 2/2] drm/amd/display: Fix null check for pipe_ctx->plane_state in hwss_setup_dpp
Posted by Alex Deucher 5 days, 19 hours ago
Applied both.

Thanks!

Alex

On Thu, Nov 14, 2024 at 3:29 AM Chung, ChiaHsuan (Tom)
<chiahsuan.chung@amd.com> wrote:
>
> Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
>
> On 11/5/2024 10:01 PM, Zicheng Qu wrote:
> > 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 <quzicheng@huawei.com>
> > ---
> >   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/drivers/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 = pipe_ctx->plane_res.dpp;
> >       struct dc_plane_state *plane_state = pipe_ctx->plane_state;
> >
> > +     if (!plane_state)
> > +             return;
> > +
> >       if (dpp && dpp->funcs->dpp_setup) {
> >               // program the input csc
> >               dpp->funcs->dpp_setup(dpp,