All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luca Ceresoli" <luca.ceresoli@bootlin.com>
Cc: Frank.Li@kernel.org, devicetree@vger.kernel.org,
	dri-devel@lists.freedesktop.org, robh@kernel.org,
	imx@lists.linux.dev, conor+dt@kernel.org
Subject: Re: [PATCH v3 03/11] drm/mxsfb/lcdif: use dev_err_probe() consistently in lcdif_attach_bridge
Date: Thu, 13 Aug 2026 23:30:33 +0000	[thread overview]
Message-ID: <20260813233034.35FB71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260402-drm-lcdif-dbanc-v3-3-27cd247a0847@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Allocating the DRM encoder with devm_kzalloc() causes a use-after-free on device unbind if userspace holds a DRM file descriptor open.
--

--- Patch [3]: [PATCH v3 03/11] drm/mxsfb/lcdif: use dev_err_probe() consistently in lcdif_attach_bridge ---
commit acad1a96fd5b86c6ee99f36bf8b226bbe0b10059
Author: Luca Ceresoli <luca.ceresoli@bootlin.com>

drm/mxsfb/lcdif: use dev_err_probe() consistently in lcdif_attach_bridge

This commit updates error paths in lcdif_attach_bridge() to consistently use
dev_err_probe() instead of dev_err(), simplifying the code and improving
error reporting.

> diff --git a/drivers/gpu/drm/mxsfb/lcdif_drv.c b/drivers/gpu/drm/mxsfb/lcdif_drv.c
> index 8da8a265c05c8..1c76709c4d94d 100644
> --- a/drivers/gpu/drm/mxsfb/lcdif_drv.c
> +++ b/drivers/gpu/drm/mxsfb/lcdif_drv.c
[ ... ]
> @@ -75,20 +73,18 @@ static int lcdif_attach_bridge(struct lcdif_drm_private *lcdif)
>  					     of_ep.id);
>  
>  		encoder = devm_kzalloc(dev, sizeof(*encoder), GFP_KERNEL);

[Severity: High]
This is a pre-existing issue, but could this devm_kzalloc() cause a
use-after-free on device unbind?

The DRM device is initialized with drmm_mode_config_init(), which ties
drm_mode_config_cleanup() to the drm_device lifetime. If userspace holds a DRM
file descriptor open during driver unbind, devres will free the encoder memory
tied to the physical device.

Later, when the last DRM file descriptor is closed, drm_mode_config_cleanup()
will iterate over the mode config's encoder list and access the already freed
encoder to call encoder->funcs->destroy(), leading to a use-after-free.

> -		if (!encoder) {
> -			dev_err(dev, "Failed to allocate encoder for endpoint%u\n",
> -				of_ep.id);
> -			return -ENOMEM;
> -		}
> +		if (!encoder)
> +			return dev_err_probe(dev, -ENOMEM,
> +					     "Failed to allocate encoder for endpoint%u\n",
> +					     of_ep.id);

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260402-drm-lcdif-dbanc-v3-0-27cd247a0847@bootlin.com?part=3

  reply	other threads:[~2026-08-13 23:30 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02  9:25 [PATCH v3 00/11] drm/mxsfb/lcdif: use DRM_BRIDGE_ATTACH_NO_CONNECTOR and the bridge-connector Luca Ceresoli
2026-04-02  9:25 ` [PATCH v3 01/11] drm/mxsfb/lcdif: simplify remote pointer management using __free Luca Ceresoli
2026-04-02  9:25 ` [PATCH v3 02/11] drm/mxsfb/lcdif: simplify ep " Luca Ceresoli
2026-08-13 23:24   ` sashiko-bot
2026-04-02  9:25 ` [PATCH v3 03/11] drm/mxsfb/lcdif: use dev_err_probe() consistently in lcdif_attach_bridge Luca Ceresoli
2026-08-13 23:30   ` sashiko-bot [this message]
2026-04-02  9:25 ` [PATCH v3 04/11] drm/mxsfb/lcdif: move iteration-specific variables declaration inside loop " Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 05/11] drm/bridge: dw-hdmi: document the output_port field Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 06/11] drm/bridge: dw-hdmi: warn on unsupported attach combination Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 07/11] drm/bridge: dw-hdmi: move next_bridge lookup to attach time Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 08/11] drm/bridge: imx8mp-hdmi-tx-connector-fixup: add an hdmi-connector when missing using a DT overlay at boot time Luca Ceresoli
2026-04-03  9:28   ` Liu Ying
2026-04-07 12:43     ` Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 09/11] drm/bridge: imx8mp-hdmi-tx-connector-fixup: show a warning when adding the overlay Luca Ceresoli
2026-04-03  9:35   ` Liu Ying
2026-04-02  9:26 ` [PATCH v3 10/11] drm/bridge: imx8mp-hdmi-tx: switch to DRM_BRIDGE_ATTACH_NO_CONNECTOR Luca Ceresoli
2026-04-02  9:26 ` [PATCH v3 11/11] drm/mxsfb/lcdif: use DRM_BRIDGE_ATTACH_NO_CONNECTOR and the bridge-connector Luca Ceresoli

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=20260813233034.35FB71F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=imx@lists.linux.dev \
    --cc=luca.ceresoli@bootlin.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.