From: Liviu Dudau <liviu.dudau@arm.com>
To: "Adrián Larumbe" <adrian.larumbe@collabora.com>
Cc: Boris Brezillon <boris.brezillon@collabora.com>,
Steven Price <steven.price@arm.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Heiko Stuebner <heiko@sntech.de>,
Grant Likely <grant.likely@linaro.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
Sashiko <noreply@sashiko.dev>
Subject: Re: [PATCH v4 1/3] drm/panthor: Check for sparse binding range overflow
Date: Mon, 6 Jul 2026 11:55:58 +0100 [thread overview]
Message-ID: <akuJvu4Um7_zL659@e142607> (raw)
In-Reply-To: <20260704-vm_bind_checks-v4-1-4705b6ca9f8a@collabora.com>
On Sat, Jul 04, 2026 at 05:46:44AM +0100, Adrián Larumbe wrote:
> This check is being already carried out further down the call stack inside
> drm_gpuvm_sm_map -> drm_gpuvm_range_valid, but it's best to fail early in
> the driver before GPUVM functions are invoked so that we won't waste time
> allocating vm_bind context resources.
>
> Reported-by: Sashiko <noreply@sashiko.dev>
> Closes: https://sashiko.dev/#/message/20260623204220.CDB1B1F000E9%40smtp.kernel.org
> Fixes: 12cf826bf1dd ("drm/panthor: Support sparse mappings")
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Best regards,
Liviu
> ---
> drivers/gpu/drm/panthor/panthor_mmu.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpu/drm/panthor/panthor_mmu.c b/drivers/gpu/drm/panthor/panthor_mmu.c
> index 31cc57029c12..163231c1703d 100644
> --- a/drivers/gpu/drm/panthor/panthor_mmu.c
> +++ b/drivers/gpu/drm/panthor/panthor_mmu.c
> @@ -2975,12 +2975,16 @@ panthor_vm_bind_prepare_op_ctx(struct drm_file *file,
> {
> ssize_t vm_pgsz = panthor_vm_page_size(vm);
> struct drm_gem_object *gem;
> + u64 end;
> int ret;
>
> /* Aligned on page size. */
> if (!IS_ALIGNED(op->va | op->size | op->bo_offset, vm_pgsz))
> return -EINVAL;
>
> + if (check_add_overflow(op->va, op->size, &end))
> + return -EINVAL;
> +
> switch (op->flags & DRM_PANTHOR_VM_BIND_OP_TYPE_MASK) {
> case DRM_PANTHOR_VM_BIND_OP_TYPE_MAP:
> if (!(op->flags & DRM_PANTHOR_VM_BIND_OP_MAP_SPARSE)) {
>
> --
> 2.55.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
next prev parent reply other threads:[~2026-07-06 10:56 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-04 4:46 [PATCH v4 0/3] Add vm_bind param check to ensure no overlap with kbo AS carveout Adrián Larumbe
2026-07-04 4:46 ` [PATCH v4 1/3] drm/panthor: Check for sparse binding range overflow Adrián Larumbe
2026-07-06 10:55 ` Liviu Dudau [this message]
2026-07-04 4:46 ` [PATCH v4 2/3] drm/panthor: Add vm_bind region with kbo range overlap check Adrián Larumbe
2026-07-06 10:57 ` Liviu Dudau
2026-07-06 17:27 ` Adrián Larumbe
2026-07-04 4:46 ` [PATCH v4 3/3] drm/panthor: Fix comment to reflect actual struct field name Adrián Larumbe
2026-07-06 10:58 ` Liviu Dudau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=akuJvu4Um7_zL659@e142607 \
--to=liviu.dudau@arm.com \
--cc=adrian.larumbe@collabora.com \
--cc=airlied@gmail.com \
--cc=boris.brezillon@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=grant.likely@linaro.org \
--cc=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=noreply@sashiko.dev \
--cc=simona@ffwll.ch \
--cc=steven.price@arm.com \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.