Patch "drm/buddy: check range allocation matches alignment" has been added to the 6.7-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/buddy: check range allocation matches alignment

to the 6.7-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-buddy-check-range-allocation-matches-alignment.patch
and it can be found in the queue-6.7 subdirectory.

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



commit c80477a8f7f846b7692c1dbc47aba60f7a612feb
Author: Matthew Auld <matthew.auld@xxxxxxxxx>
Date:   Mon Feb 19 12:18:53 2024 +0000

    drm/buddy: check range allocation matches alignment
    
    [ Upstream commit 2986314aa811c8a23aeb292edd30315495d54966 ]
    
    Likely not a big deal for real users, but for consistency we should
    respect the min_page_size here. Main issue is that bias allocations
    turns into normal range allocation if the range and size matches
    exactly, and in the next patch we want to add some unit tests for this
    part of the api.
    
    Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
    Cc: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
    Cc: Christian König <christian.koenig@xxxxxxx>
    Reviewed-by: Arunpravin Paneer Selvam <Arunpravin.PaneerSelvam@xxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240219121851.25774-5-matthew.auld@xxxxxxxxx
    Signed-off-by: Christian König <christian.koenig@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_buddy.c b/drivers/gpu/drm/drm_buddy.c
index f3a6ac908f815..5ebdd6f8f36e6 100644
--- a/drivers/gpu/drm/drm_buddy.c
+++ b/drivers/gpu/drm/drm_buddy.c
@@ -771,8 +771,12 @@ int drm_buddy_alloc_blocks(struct drm_buddy *mm,
 		return -EINVAL;
 
 	/* Actual range allocation */
-	if (start + size == end)
+	if (start + size == end) {
+		if (!IS_ALIGNED(start | end, min_block_size))
+			return -EINVAL;
+
 		return __drm_buddy_alloc_range(mm, start, size, NULL, blocks);
+	}
 
 	original_size = size;
 	original_min_size = min_block_size;




[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