From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Jiasheng Jiang <jiasheng@iscas.ac.cn>,
robdclark@gmail.com, quic_abhinavk@quicinc.com, sean@poorly.run,
airlied@gmail.com, daniel@ffwll.ch, quic_jesszhan@quicinc.com,
ville.syrjala@linux.intel.com, yang.lee@linux.alibaba.com
Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org,
freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/msm/dpu: Add check for cstate
Date: Sun, 8 Jan 2023 23:56:07 +0200 [thread overview]
Message-ID: <e56c48c2-8439-c9c8-c735-95adece3c68d@linaro.org> (raw)
In-Reply-To: <20221206080517.43786-1-jiasheng@iscas.ac.cn>
On 06/12/2022 10:05, Jiasheng Jiang wrote:
> As kzalloc may fail and return NULL pointer,
> it should be better to check cstate
> in order to avoid the NULL pointer dereference
> in __drm_atomic_helper_crtc_reset.
>
> Fixes: 1cff7440a86e ("drm/msm: Convert to using __drm_atomic_helper_crtc_reset() for reset.")
> Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> index 13ce321283ff..22c2787b7b38 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c
> @@ -968,7 +968,10 @@ static void dpu_crtc_reset(struct drm_crtc *crtc)
> if (crtc->state)
> dpu_crtc_destroy_state(crtc, crtc->state);
>
> - __drm_atomic_helper_crtc_reset(crtc, &cstate->base);
> + if (cstate)
> + __drm_atomic_helper_crtc_reset(crtc, &cstate->base);
> + else
> + __drm_atomic_helper_crtc_reset(crtc, NULL);
NAK.
The proper fix is to add the if() but to skip the else clause. We should
not reset the crtc's state if memory allocation failed.
> }
>
> /**
--
With best wishes
Dmitry
next prev parent reply other threads:[~2023-01-08 21:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 8:05 Jiasheng Jiang
2022-12-06 16:32 ` Abhinav Kumar
2023-01-08 21:56 ` Dmitry Baryshkov [this message]
2023-01-08 22:08 ` Dmitry Baryshkov
2023-01-26 19:01 ` Dmitry Baryshkov
-- strict thread matches above, loose matches on Subject: below --
2022-12-06 8:02 Jiasheng Jiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e56c48c2-8439-c9c8-c735-95adece3c68d@linaro.org \
--to=dmitry.baryshkov@linaro.org \
--cc=airlied@gmail.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=jiasheng@iscas.ac.cn \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_jesszhan@quicinc.com \
--cc=robdclark@gmail.com \
--cc=sean@poorly.run \
--cc=ville.syrjala@linux.intel.com \
--cc=yang.lee@linux.alibaba.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®