From: sashiko-bot@kernel.org
To: "Oarora Etimis" <oaroraetimis@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 2/7] drm/vkms: free the colorop whose initialization failed
Date: Sat, 28 Nov 2026 17:27:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-238879@kernel.org> (raw)
In-Reply-To: <20261128-colorop-v1-2-dd79919f822b@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] drm/vkms: NULL dereference in drm_colorop_cleanup() on failed
colorop init
--
commit 19fa2bf1e8d2d6f8cce50424490f5da439214e86
Author: Oarora Etimis <oaroraetimis@gmail.com>
drm/vkms: free the colorop whose initialization failed
This commit extends the error cleanup loop in
vkms_initialize_color_pipeline() to include ops[i] so that a colorop
whose initialization fails is cleaned up and freed.
> diff --git a/drivers/gpu/drm/vkms/vkms_colorop.c b/drivers/gpu/drm/vkms/vkms_colorop.c
> index 9424b1994239a..ed557a1c6a056 100644
> --- a/drivers/gpu/drm/vkms/vkms_colorop.c
> +++ b/drivers/gpu/drm/vkms/vkms_colorop.c
> @@ -126,7 +126,7 @@ static int vkms_initialize_color_pipeline(struct drm_plane *plane, struct drm_pr
> return 0;
>
> cleanup:
> - for (j = 0; j < i; j++) {
> + for (j = 0; j <= i && j < ARRAY_SIZE(ops); j++) {
> if (ops[j]) {
> drm_colorop_cleanup(ops[j]);
> kfree(ops[j]);
[Severity: Medium]
Can calling drm_colorop_cleanup(ops[i]) after a failed
drm_plane_colorop_*_init() cause a NULL pointer dereference?
Each drm_plane_colorop_*_init() helper delegates to
drm_plane_colorop_init(), which can fail in drm_mode_object_add() before
initializing colorop->dev or linking colorop->head:
drivers/gpu/drm/drm_colorop.c:drm_plane_colorop_init() {
ret = drm_mode_object_add(dev, &colorop->base, DRM_MODE_OBJECT_COLOROP);
if (ret)
return ret;
colorop->base.properties = &colorop->properties;
colorop->dev = dev;
...
list_add_tail(&colorop->head, &config->colorop_list);
colorop->index = config->num_colorop++;
When drm_mode_object_add() fails, ops[i]->dev and ops[i]->head are still
zeroed, so drm_colorop_cleanup(ops[i]) dereferences NULL in
list_del(&colorop->head) and config->num_colorop--. Freeing ops[i] with
kfree() without calling drm_colorop_cleanup() on the failed entry avoids
this.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261128-colorop-v1-0-dd79919f822b@gmail.com?part=2
next prev parent reply other threads:[~2026-11-28 17:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-28 17:15 [PATCH 0/7] drm/vkms: complete the plane color pipeline Oarora Etimis
2026-11-28 17:15 ` [PATCH 1/7] drm/vkms: add the colorops of a plane that is being enabled Oarora Etimis
2026-11-28 17:15 ` [PATCH 2/7] drm/vkms: free the colorop whose initialization failed Oarora Etimis
2026-11-28 17:27 ` sashiko-bot [this message]
2026-11-28 17:15 ` [PATCH 3/7] drm/vkms: use the colorop states of the state being composed Oarora Etimis
2026-11-28 17:31 ` sashiko-bot
2026-11-28 17:15 ` [PATCH 4/7] drm/vkms: add a programmable 1D LUT colorop Oarora Etimis
2026-11-28 17:25 ` sashiko-bot
2026-11-28 17:15 ` [PATCH 5/7] drm/vkms: add a 3D " Oarora Etimis
2026-11-28 17:34 ` sashiko-bot
2026-11-28 17:15 ` [PATCH 6/7] drm/vkms: add a multiplier colorop Oarora Etimis
2026-11-28 17:31 ` sashiko-bot
2026-11-28 17:15 ` [PATCH 7/7] drm/vkms: add KUnit coverage for the 3D LUT and multiplier colorops Oarora Etimis
2026-11-29 12:37 ` [PATCH 0/7] drm/vkms: complete the plane color pipeline Louis Chauvet
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=sashiko-outbox-238879@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=oaroraetimis@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox