From: Alessio Belle <Alessio.Belle@imgtec.com>
To: "shuvampandey1@gmail.com" <shuvampandey1@gmail.com>
Cc: "tzimmermann@suse.de" <tzimmermann@suse.de>,
"donald.robson@imgtec.com" <donald.robson@imgtec.com>,
"simona@ffwll.ch" <simona@ffwll.ch>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"matt.coster@imgtec.com" <matt.coster@imgtec.com>,
"airlied@gmail.com" <airlied@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Frank Binns <Frank.Binns@imgtec.com>,
"sarah.walker@imgtec.com" <sarah.walker@imgtec.com>,
"maarten.lankhorst@linux.intel.com"
<maarten.lankhorst@linux.intel.com>,
"mripard@kernel.org" <mripard@kernel.org>,
"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: Re: [PATCH] drm/imagination: Fix user array stride in pvr_set_uobj_array()
Date: Wed, 1 Jul 2026 18:16:17 +0000 [thread overview]
Message-ID: <0e06638962a5273bc6dd1639ab2fa7092d8a8a5c.camel@imgtec.com> (raw)
In-Reply-To: <178155996993.4848.8618351576278880213@gmail.com>
Hi Shuvam,
On Tue, 2026-06-16 at 03:31 +0545, shuvampandey1@gmail.com wrote:
> pvr_set_uobj_array() copies an array of kernel objects to a userspace
> array whose element size is described by out->stride. When out->stride
> is different from the kernel object size, the slow path advances the
> userspace pointer by the kernel object size and the kernel pointer by the
> userspace stride.
>
> This reverses the intended layout. For larger userspace strides, later
> copies read from the wrong kernel addresses. For smaller userspace
> strides, later copies are written at the wrong userspace offsets. The
> padding clear is also done only for the first element instead of the
> padding area for each element.
>
> Advance the userspace pointer by out->stride and the kernel pointer by
> obj_size, and clear per-element padding while the current userspace
> pointer is still available.
>
> Fixes: f99f5f3ea7ef ("drm/imagination: Add GPU ID parsing and firmware loading")
> Cc: stable@vger.kernel.org # v6.8+
> Signed-off-by: Shuvam Pandey <shuvampandey1@gmail.com>
Could you resend the patch with the "From:" header fixed up with name + email,
to match the signed off line? Somehow the name got lost.
Everything else looks good, so with that sorted,
Reviewed-by: Alessio Belle <alessio.belle@imgtec.com>
Thanks,
Alessio
> ---
> drivers/gpu/drm/imagination/pvr_drv.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/imagination/pvr_drv.c b/drivers/gpu/drm/imagination/pvr_drv.c
> index 268900464ab6..0a68a9c32361 100644
> --- a/drivers/gpu/drm/imagination/pvr_drv.c
> +++ b/drivers/gpu/drm/imagination/pvr_drv.c
> @@ -1252,14 +1252,13 @@ pvr_set_uobj_array(const struct drm_pvr_obj_array *out, u32 min_stride, u32 obj_
> if (copy_to_user(out_ptr, in_ptr, cpy_elem_size))
> return -EFAULT;
>
> - out_ptr += obj_size;
> - in_ptr += out->stride;
> - }
> + if (out->stride > obj_size &&
> + clear_user(out_ptr + cpy_elem_size, out->stride - obj_size)) {
> + return -EFAULT;
> + }
>
> - if (out->stride > obj_size &&
> - clear_user(u64_to_user_ptr(out->array + obj_size),
> - out->stride - obj_size)) {
> - return -EFAULT;
> + out_ptr += out->stride;
> + in_ptr += obj_size;
> }
> }
>
prev parent reply other threads:[~2026-07-01 18:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 21:46 shuvampandey1
2026-07-01 18:16 ` Alessio Belle [this message]
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=0e06638962a5273bc6dd1639ab2fa7092d8a8a5c.camel@imgtec.com \
--to=alessio.belle@imgtec.com \
--cc=Frank.Binns@imgtec.com \
--cc=airlied@gmail.com \
--cc=donald.robson@imgtec.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=matt.coster@imgtec.com \
--cc=mripard@kernel.org \
--cc=sarah.walker@imgtec.com \
--cc=shuvampandey1@gmail.com \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®