mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ruben Wauters <rubenru09@aol.com>
To: Sajal Gupta <sajal2005gupta@gmail.com>
Cc: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, 	airlied@gmail.com, simona@ffwll.ch,
	noralf@tronnes.org, 	dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, Sashiko	 <sashiko-bot@kernel.org>
Subject: Re: [PATCH] drm/gud: fix out-of-bounds write in gud_plane_atomic_check()
Date: Sat, 12 Sep 2026 13:35:57 +0100	[thread overview]
Message-ID: <43b9f5782e43ef795a53976a3b15ee09c304ec1f.camel@aol.com> (raw)
In-Reply-To: <20260902123254.36987-1-sajal2005gupta@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2915 bytes --]

On Wed, 2026-09-02 at 18:00 +0530, Sajal Gupta wrote:
> The plane property loop uses req->properties[num_properties + i] as write
> index while simultaneously incrementing `num_properties` inside the loop.
> At iteration i, num_properties has also incremented by i, so the write
> is done at `initial_num_properties + 2*i`, skipping every other index and
> advancing by 2 per iteration.
> 
> With just 2 connector and 32 plane properties the last write happens at
> index 64, one slot past the end of the 64-slot (indices 0–63)
> allocation. A USB device can trigger OOB by advertising the maximum
> number of properties.
> 
> Fix by dropping the redundant `+ i`; num_properties is already the correct
> running index, as gud_connector_fill_properties() fills the preceding
> slots.
> 
> Fixes: 40e1a70b4aed ("drm: Add GUD USB Display driver")
> Reported-by: Sashiko <sashiko-bot@kernel.org>
> Link: https://sashiko.dev/#/patchset/20260821071812.16500-1-sajal2005gupta%40gmail.com?part=1
> Signed-off-by: Sajal Gupta <sajal2005gupta@gmail.com>
Cc: <stable@vger.kernel.org>
Acked-by: Ruben Wauters <rubenru09@aol.com>

Sorry, for some reason I didn't receive this patch in my mailbox, only
by manually searching for patches did I find it, thanks for the patch.
> ---
> 
> Verified with KASAN using a raw-gadget fake GUD device reporting 2
> connector properties and 32 plane properties:
> 
>   BUG: KASAN: slab-out-of-bounds in gud_plane_atomic_check+0x1352/0x1ba0
>   Write of size 2 at addr ffff88800d029a9a by task temm/270
> 
>   Call Trace:
>    <TASK>
>    kasan_report+0xfa/0x120
>    gud_plane_atomic_check+0x1352/0x1ba0
>    drm_atomic_helper_check_planes+0x2f2/0x9b0
>    drm_atomic_helper_check+0x72/0x140
>    drm_atomic_check_only+0x127b/0x3420
>    drm_atomic_commit+0x124/0x2e0
>    drm_atomic_helper_set_config+0xd9/0x130
>    drm_mode_setcrtc+0xcfd/0x1b20
>    drm_ioctl_kernel+0x167/0x2d0
>    drm_ioctl+0x53f/0xbe0
>    __x64_sys_ioctl+0x137/0x1c0
>    do_syscall_64+0xde/0x4b0
>    </TASK>
> 
>   The buggy address is located 0 bytes to the right of
>   allocated 666-byte region [ffff88800d029800, ffff88800d029a9a)
> 
> 
>  drivers/gpu/drm/gud/gud_pipe.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/gud/gud_pipe.c b/drivers/gpu/drm/gud/gud_pipe.c
> index 5ef887d8485a..54adc401bc1b 100644
> --- a/drivers/gpu/drm/gud/gud_pipe.c
> +++ b/drivers/gpu/drm/gud/gud_pipe.c
> @@ -562,8 +562,8 @@ int gud_plane_atomic_check(struct drm_plane *plane,
>  			goto out;
>  		}
> 
> -		req->properties[num_properties + i].prop = cpu_to_le16(prop);
> -		req->properties[num_properties + i].val = cpu_to_le64(val);
> +		req->properties[num_properties].prop = cpu_to_le16(prop);
> +		req->properties[num_properties].val = cpu_to_le64(val);
>  		num_properties++;
>  	}
> 
> --
> 2.55.0

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

      reply	other threads:[~2026-09-12 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 12:30 Sajal Gupta
2026-09-12 12:35 ` Ruben Wauters [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=43b9f5782e43ef795a53976a3b15ee09c304ec1f.camel@aol.com \
    --to=rubenru09@aol.com \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=noralf@tronnes.org \
    --cc=sajal2005gupta@gmail.com \
    --cc=sashiko-bot@kernel.org \
    --cc=simona@ffwll.ch \
    --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®