Patch "drm/msm/dpu: Disallow unallocated resources to be returned" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/msm/dpu: Disallow unallocated resources to be returned

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-dpu-disallow-unallocated-resources-to-be-ret.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 735cc9253fef70434a7899992da62ca6594feaa6
Author: Marijn Suijten <marijn.suijten@xxxxxxxxxxxxxx>
Date:   Tue Jan 10 00:15:55 2023 +0100

    drm/msm/dpu: Disallow unallocated resources to be returned
    
    [ Upstream commit abc40122d9a69f56c04efb5a7485795f5ac799d1 ]
    
    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, until their allocation/assignment is being sanity-checked in
    "drm/msm/dpu: Reject topologies for which no DSC blocks are available")
    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@xxxxxxxxxxxxxx>
    Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/517636/
    Link: https://lore.kernel.org/r/20230109231556.344977-1-marijn.suijten@xxxxxxxxxxxxxx
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
index 73b3442e74679..7ada957adbbb8 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c
@@ -660,6 +660,11 @@ int dpu_rm_get_assigned_resources(struct dpu_rm *rm,
 				  blks_size, enc_id);
 			break;
 		}
+		if (!hw_blks[i]) {
+			DPU_ERROR("Allocated resource %d unavailable to assign to enc %d\n",
+				  type, enc_id);
+			break;
+		}
 		blks[num_blks++] = hw_blks[i];
 	}
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux