[PATCH v2 4/8] drm/msm/dpu: Disallow unallocated resources to be returned
Dmitry Baryshkov
dmitry.baryshkov at linaro.org
Sun Jan 8 23:28:52 UTC 2023
On 22/12/2022 01:19, Marijn Suijten wrote:
> In the event that the topology requests resources that have not been
> created by the system (because they are typically not represented in
> dpu_mdss_cfg ^1), the resource(s) in global_state (in this case DSC
> blocks) remain NULL but will still be returned out of
> dpu_rm_get_assigned_resources, where the caller expects to get an array
> containing num_blks valid pointers (but instead gets these NULLs).
>
> To prevent this from happening, where null-pointer dereferences
> typically result in a hard-to-debug platform lockup, num_blks shouldn't
> increase past NULL blocks and will print an error and break instead.
> After all, max_blks represents the static size of the maximum number of
> blocks whereas the actual amount varies per platform.
>
> ^1: which can happen after a git rebase ended up moving additions to
> _dpu_cfg to a different struct which has the same patch context.
>
> Fixes: bb00a452d6f7 ("drm/msm/dpu: Refactor resource manager")
> Signed-off-by: Marijn Suijten <marijn.suijten at somainline.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c | 5 +++++
> 1 file changed, 5 insertions(+)
I think the patch is not fully correct. Please check resource
availability during allocation. I wouldn't expect an error from
get_assigned_resources because of resource exhaustion.
--
With best wishes
Dmitry
More information about the dri-devel
mailing list