From: sashiko-bot@kernel.org
To: "Leandro Ribeiro" <leandro.ribeiro@collabora.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 06/11] drm/vkms: rename struct vkms_color_lut::base to y
Date: Tue, 04 Aug 2026 20:52:35 +0000 [thread overview]
Message-ID: <20260804205236.BEA561F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804203351.148521-7-leandro.ribeiro@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [Critical] vkms_composer_worker accesses the global crtc->state asynchronously, creating a Use-After-Free (UAF) vulnerability.
- [High] vkms_atomic_check incorrectly divides gamma_lut length by sizeof(pointer) instead of sizeof(struct) on 32-bit systems.
--
--- Patch [6]: [PATCH 06/11] drm/vkms: rename struct vkms_color_lut::base to y ---
commit 89753bc7023e7c4dac9293962b90fb28fe7958fd
Author: Leandro Ribeiro <leandro.ribeiro@collabora.com>
drm/vkms: rename struct vkms_color_lut::base to y
This patch renames the base field in struct vkms_color_lut to y to prepare
for the addition of an x field in future commits. It updates all usages of
the field across the driver's tests, composer, and LUT initialization code.
There is no intended functional change.
> diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c
> --- a/drivers/gpu/drm/vkms/vkms_composer.c
> +++ b/drivers/gpu/drm/vkms/vkms_composer.c
[ ... ]
> @@ -641,7 +641,7 @@ void vkms_composer_worker(struct work_struct *work)
> s64 max_lut_index_fp;
> s64 u16_max_fp = drm_int2fixp(0xffff);
>
> - crtc_state->gamma_lut.base = (struct drm_color_lut *)crtc->state->gamma_lut->data;
> + crtc_state->gamma_lut.y = (struct drm_color_lut *)crtc->state->gamma_lut->data;
[Severity: Critical]
This isn't a bug introduced by this patch, but does accessing the global
crtc->state asynchronously here create a use-after-free vulnerability?
If userspace submits rapid non-blocking atomic commits, crtc->state can be
swapped by drm_atomic_helper_commit() and its previous gamma_lut blob freed
while vkms_composer_worker() is still executing.
Could this lead to the worker dereferencing the freed gamma_lut->data pointer
later in apply_lut_to_channel_value()?
> crtc_state->gamma_lut.lut_length =
> crtc->state->gamma_lut->length / sizeof(struct drm_color_lut);
> max_lut_index_fp = drm_int2fixp(crtc_state->gamma_lut.lut_length - 1);
[ ... ]
While reviewing the gamma LUT handling, I also noticed the following in
vkms_drv.c:vkms_atomic_check():
> if (new_crtc_state->gamma_lut->length / sizeof(struct drm_color_lut *)
> > VKMS_GAMMA_LUT_SIZE)
> return -EINVAL;
[Severity: High]
This is a pre-existing issue, but does vkms_atomic_check() incorrectly divide
by sizeof(struct drm_color_lut *) instead of sizeof(struct drm_color_lut)?
On 32-bit systems where pointers are 4 bytes, a 256-entry LUT evaluates to a
length of 512, which exceeds VKMS_GAMMA_LUT_SIZE (256) and rejects valid
atomic commits with -EINVAL.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804203351.148521-1-leandro.ribeiro@collabora.com?part=6
next prev parent reply other threads:[~2026-08-04 20:52 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 20:33 [PATCH 00/11] drm/vkms: improve color curve LUTs precision Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 01/11] drm/vkms: rename VKMS_LUT_SIZE to VKMS_GAMMA_LUT_SIZE Leandro Ribeiro
2026-08-04 20:41 ` sashiko-bot
2026-08-04 20:33 ` [PATCH 02/11] drm/vkms: allow color curve LUTs to have different sizes Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 03/11] drm/vkms: remove TEST_LUT_SIZE Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 04/11] drm/vkms: remove linear_eotf Leandro Ribeiro
2026-08-04 20:42 ` sashiko-bot
2026-08-04 20:33 ` [PATCH 05/11] drm/vkms: improve the way in which we access LUT member Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 06/11] drm/vkms: rename struct vkms_color_lut::base to y Leandro Ribeiro
2026-08-04 20:52 ` sashiko-bot [this message]
2026-08-04 20:33 ` [PATCH 07/11] drm/vkms: rename get_lut_index() to get_uniform_lut_index() Leandro Ribeiro
2026-08-04 20:47 ` sashiko-bot
2026-08-04 20:33 ` [PATCH 08/11] drm/vkms: add support to non-uniform LUT for internal color curves Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 09/11] drm/vkms: test sRGB and inverse sRGB LUTs using more samples Leandro Ribeiro
2026-08-04 20:33 ` [PATCH 10/11] drm/vkms: add script to create optimized LUTs for color curves Leandro Ribeiro
2026-08-04 20:47 ` sashiko-bot
2026-08-04 20:33 ` [PATCH 11/11] drm/vkms: replace uniform sRGB LUT and its inverse with optimal ones Leandro Ribeiro
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=20260804205236.BEA561F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=leandro.ribeiro@collabora.com \
--cc=sashiko-reviews@lists.linux.dev \
/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.