From: sashiko-bot@kernel.org
To: "Màxim Pedraza Padilla" <maximpedraza@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
dri-devel@lists.freedesktop.org
Subject: Re: [PATCH RFC v4 03/13] drm: client: add splash client
Date: Fri, 02 Oct 2026 09:13:39 +0000 [thread overview]
Message-ID: <20261002091339.B64EB1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20261001195847.141192-4-maximpedraza@gmail.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/client: splash: UAF of drm_framebuffer on hotplug error path
- [Medium] drm/client: splash: memory leak of scanout array on hotplug -ENODEV
- [Medium] drm/client: splash: firmware blob leak if render thread exits with -EBUSY
--
commit 86a0b0be0de60a4b9d33ab49ce7a129fe48448a6
Author: Francesco Valla <francesco@valla.it>
Date: Thu Oct 1 19:58:37 2026 +0000
drm: client: add splash client
Add a DRM client that draws a simple splash, with possibility to show:
- the logo provided by EFI BGRT;
- a static BMP image (loaded as firmware);
- a colored background.
> diff --git a/drivers/gpu/drm/clients/drm_splash.c b/drivers/gpu/drm/clients/drm_splash.c
> new file mode 100644
> index 0000000000000..66c192139d9c4
> --- /dev/null
> +++ b/drivers/gpu/drm/clients/drm_splash.c
> @@ -0,0 +1,1028 @@
[ ... ]
> +static void drm_splash_fw_callback(const struct firmware *fw, void *context)
> +{
> + struct drm_splash *splash = context;
> + struct drm_client_dev *client = &splash->client;
> +
> + if (!fw || !fw->data) {
> + drm_err(client->dev, "splash: no firmware");
> + release_firmware(fw);
> + fw = NULL;
> + }
> +
> + scoped_guard(spinlock, &splash->fw_lock)
> + splash->fw = fw;
[ ... ]
> +static int drm_splash_render_thread(void *data)
> +{
> + struct drm_splash *splash = data;
> + struct drm_client_dev *client = &splash->client;
> +
> + while (!kthread_should_stop()) {
[ ... ]
> + if (draw_count > 0) {
> + ret = drm_client_modeset_commit(client);
> + /* If commit returns EBUSY, another master showed up.
> + * This means that the splash is no more required.
> + */
> + if (ret == -EBUSY) {
> + drm_info(client->dev, "splash: not master anymore, exiting");
> + break;
> + }
[Severity: Medium]
Can the firmware blob be leaked if the render thread exits early here?
If drm_client_modeset_commit() returns -EBUSY, the thread breaks out of the
loop and exits. If the firmware request later completes,
drm_splash_fw_callback() stores the firmware in splash->fw. Since the thread
is already dead, won't this firmware remain unreleased until the DRM device is
completely unregistered?
> + }
[ ... ]
> +static int drm_splash_init_client(struct drm_splash *splash)
> +{
[ ... ]
> + /* And point every modeset at the buffer of its scanout */
> + i = 0;
> + drm_client_for_each_modeset(modeset, client) {
> + unsigned int idx = i++;
> +
> + if (idx >= 32)
> + break;
> +
> + for (k = 0; k < splash->n_scanout; k++) {
> + struct drm_splash_scanout *scanout = &splash->scanout[k];
> +
> + if (scanout->buffer && (scanout->modesets & BIT(idx))) {
> + modeset->fb = scanout->buffer->fb;
> + break;
> + }
> + }
> + }
> +
> + mutex_unlock(&client->modeset_mutex);
> +
> + return (fb_count == 0) ? -ENODEV : 0;
> +}
[ ... ]
> +static int drm_splash_client_hotplug(struct drm_client_dev *client)
> +{
> + struct drm_splash *splash = client_to_drm_splash(client);
> + struct task_struct *thread;
> + int ret = 0;
> +
> + guard(mutex)(&splash->hotplug_lock);
> +
> + /* The modesets that get a splash are defined at first hotplug event */
> + if (splash->initialized)
> + return 0;
> +
> + ret = drm_splash_init_client(splash);
> + if (ret == -ENODEV) {
> + drm_info(client->dev, "splash: no modeset found");
> + return 0;
> + } else if (ret) {
[Severity: Medium]
Could this error path leak the splash->scanout array?
If drm_splash_init_client() successfully extends the array using krealloc()
but fails to create any buffers, it returns -ENODEV. This early return handles
the -ENODEV case but does not free the array.
Could subsequent hotplug events keep appending to it and leaking memory on
every failure?
> + drm_err(client->dev,
> + "splash: failed to init client: %d", ret);
> + return ret;
> + }
> +
> + /* Create the render thread, waken later */
> + thread = kthread_create(drm_splash_render_thread, splash,
> + "drm_splash_%s", client->dev->unique);
> + if (IS_ERR(thread)) {
> + ret = PTR_ERR(thread);
> + drm_err(client->dev,
> + "splash: failed to create render thread: %d", ret);
> + drm_splash_free_scanout(client);
> + return ret;
> + }
[Severity: High]
Does this error path leave dangling pointers in the client's modeset array?
In drm_splash_init_client(), modeset->fb is assigned the framebuffer of the
newly created buffer. If we fail here and call drm_splash_free_scanout(), the
buffers and their framebuffers are freed, but modeset->fb is not cleared.
Since the client remains registered on dev->clientlist even after a hotplug
error, could a subsequent modeset commit or sysrq trigger a use-after-free
by dereferencing the freed modeset->fb?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261001195847.141192-1-maximpedraza@gmail.com?part=3
next prev parent reply other threads:[~2026-10-02 9:13 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 19:58 [PATCH RFC v4 00/13] Add splash DRM client Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 01/13] drm/clients: Kconfig: indent DRM_CLIENT_DEFAULT with tabs Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 02/13] efi: bgrt: export the BGRT table and image size Màxim Pedraza Padilla
2026-10-02 7:44 ` Ard Biesheuvel
2026-10-02 9:37 ` Jani Nikula
2026-10-02 10:31 ` Màxim Pedraza Padilla
2026-10-02 10:43 ` Ard Biesheuvel
2026-10-01 19:58 ` [PATCH RFC v4 03/13] drm: client: add splash client Màxim Pedraza Padilla
2026-10-02 9:13 ` sashiko-bot [this message]
2026-10-02 9:41 ` Jani Nikula
2026-10-01 19:58 ` [PATCH RFC v4 04/13] MAINTAINERS: add entry for DRM " Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 05/13] drm: docs: remove bootsplash from TODO Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 06/13] dt-bindings: display: add a boot logo node under /chosen Màxim Pedraza Padilla
2026-10-02 9:13 ` sashiko-bot
2026-10-01 19:58 ` [PATCH RFC v4 07/13] drm/client: splash: add a device tree image source Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 08/13] drm/client: splash: place the device tree image where it asks Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 09/13] drm/client: splash: turn the device tree image as " Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 10/13] drm/client: splash: take the background colour from the image source Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 11/13] drm/client: splash: turn the BGRT image on panels mounted turned Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 12/13] drm/client: splash: prefer what the command line asks for Màxim Pedraza Padilla
2026-10-01 19:58 ` [PATCH RFC v4 13/13] drm/client: splash: document the image sources and parameters Màxim Pedraza Padilla
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=20261002091339.B64EB1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=maximpedraza@gmail.com \
--cc=robh@kernel.org \
--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.