Skip to content

Commit 5afa9d2

Browse files
olvaffestevenprice-arm
authored andcommitted
drm/panthor: check bo offset alignment in vm bind
Fail early from panthor_vm_bind_prepare_op_ctx instead of late from ops->map_pages. Signed-off-by: Chia-I Wu <olvaffe@gmail.com> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Liviu Dudau <liviu.dudau@arm.com> Reviewed-by: Steven Price <steven.price@arm.com> Signed-off-by: Steven Price <steven.price@arm.com> Link: https://lore.kernel.org/r/20250828200116.3532255-1-olvaffe@gmail.com
1 parent 33a7776 commit 5afa9d2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/gpu/drm/panthor/panthor_mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,7 +1222,7 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
12221222
(flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) != DRM_PANTHOR_VM_BIND_OP_TYPE_MAP)
12231223
return -EINVAL;
12241224

1225-
/* Make sure the VA and size are aligned and in-bounds. */
1225+
/* Make sure the VA and size are in-bounds. */
12261226
if (size > bo->base.base.size || offset > bo->base.base.size - size)
12271227
return -EINVAL;
12281228

@@ -2447,7 +2447,7 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file,
24472447
int ret;
24482448

24492449
/* Aligned on page size. */
2450-
if (!IS_ALIGNED(op->va | op->size, vm_pgsz))
2450+
if (!IS_ALIGNED(op->va | op->size | op->bo_offset, vm_pgsz))
24512451
return -EINVAL;
24522452

24532453
switch (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) {

0 commit comments

Comments
 (0)