From: sashiko-bot@kernel.org
To: "Màxim Pedraza Padilla" <maximpedraza@gmail.com>
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 07/13] drm/client: splash: add a device tree image source
Date: Tue, 13 Oct 2026 09:51:43 +0000 [thread overview]
Message-ID: <sashiko-outbox-169390@kernel.org> (raw)
In-Reply-To: <20261013093243.505776-8-maximpedraza@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] of: use-after-free of DT property data due to premature of_node_put()
--
commit 98dbc79d3322b530cd1f8ff31d16dc494f5db1c5
Author: Màxim Pedraza Padilla <maximpedraza@gmail.com>
drm/client: splash: add a device tree image source
This commit adds a device tree image source for the splash client,
allowing it to load a BMP image from a boot-logo node under /chosen
in the device tree.
> diff --git a/drivers/gpu/drm/clients/drm_splash.c b/drivers/gpu/drm/clients/drm_splash.c
> index a7d6279541587..50842922a7f82 100644
> --- a/drivers/gpu/drm/clients/drm_splash.c
> +++ b/drivers/gpu/drm/clients/drm_splash.c
[ ... ]
> @@ -212,6 +223,114 @@ static int drm_splash_fw_request_bmp(struct drm_splash *splash)
[ ... ]
> +static int drm_splash_dt_load(struct drm_splash *splash, const u8 **data,
> + size_t *size)
> +{
> + struct drm_client_dev *client = &splash->client;
> + struct device_node *np;
> + struct resource res;
> + const void *prop;
> + int len, ret = 0;
> +
> + np = drm_splash_dt_node(splash);
> + if (!np)
> + return -ENOENT;
> +
> + /*
> + * An image in the node is used in place: the device tree stays in
> + * memory for as long as the system runs, so there is nothing to copy
> + * and nothing to release.
> + */
> + prop = of_get_property(np, "image", &len);
> + if (prop) {
> + *data = prop;
> + *size = len;
> + goto out_put;
> + }
[ ... ]
> +out_put:
> + of_node_put(np);
> + return ret;
> +}
[Severity: High]
Does this code risk a use-after-free if the device tree node is dynamically
removed?
The comment notes the device tree stays in memory, but if device tree overlays
are used and the node is dynamically removed, its properties will be freed
when the reference count reaches zero.
Here, drm_splash_dt_load() assigns the pointer from of_get_property() to
*data, but then immediately drops the reference to the device tree node by
calling of_node_put() before returning.
Later, the asynchronous render thread could read this freed memory when parsing
the BMP header and blitting the image via drm_splash_bmp_to_scanout().
Should the node reference be kept in struct drm_splash and only released
later in drm_splash_image_cleanup()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261013093243.505776-1-maximpedraza@gmail.com?part=7
next prev parent reply other threads:[~2026-10-13 9:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 9:32 [PATCH v5 00/13] Add splash DRM client Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 01/13] drm/clients: Kconfig: indent DRM_CLIENT_DEFAULT with tabs Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 02/13] efi: bgrt: add accessors for the boot graphics Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 03/13] drm: client: add splash client Màxim Pedraza Padilla
2026-10-13 9:43 ` sashiko-bot
2026-10-13 9:32 ` [PATCH v5 04/13] MAINTAINERS: add entry for DRM " Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 05/13] drm: docs: remove bootsplash from TODO Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 06/13] dt-bindings: display: add a boot logo node under /chosen Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 07/13] drm/client: splash: add a device tree image source Màxim Pedraza Padilla
2026-10-13 9:51 ` sashiko-bot [this message]
2026-10-13 9:32 ` [PATCH v5 08/13] drm/client: splash: place the device tree image where it asks Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 09/13] drm/client: splash: turn the device tree image as " Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 10/13] drm/client: splash: take the background colour from the image source Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 11/13] drm/client: splash: turn the BGRT image on panels mounted turned Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 12/13] drm/client: splash: prefer what the command line asks for Màxim Pedraza Padilla
2026-10-13 9:32 ` [PATCH v5 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=sashiko-outbox-169390@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.