mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
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
This commit is contained in:
parent
33a7776f9b
commit
5afa9d2a9b
|
|
@ -1222,7 +1222,7 @@ static int panthor_vm_prepare_map_op_ctx(struct panthor_vm_op_ctx *op_ctx,
|
|||
(flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) != DRM_PANTHOR_VM_BIND_OP_TYPE_MAP)
|
||||
return -EINVAL;
|
||||
|
||||
/* Make sure the VA and size are aligned and in-bounds. */
|
||||
/* Make sure the VA and size are in-bounds. */
|
||||
if (size > bo->base.base.size || offset > bo->base.base.size - size)
|
||||
return -EINVAL;
|
||||
|
||||
|
|
@ -2447,7 +2447,7 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file,
|
|||
int ret;
|
||||
|
||||
/* Aligned on page size. */
|
||||
if (!IS_ALIGNED(op->va | op->size, vm_pgsz))
|
||||
if (!IS_ALIGNED(op->va | op->size | op->bo_offset, vm_pgsz))
|
||||
return -EINVAL;
|
||||
|
||||
switch (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user