Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>
To: Fabio Estevam <festevam@gmail.com>
Cc: marex@denx.de, mripard@kernel.org, imx@lists.linux.dev,
	 dri-devel@lists.freedesktop.org, stable@vger.kernel.org
Subject: Re: [PATCH] drm/mxsfb: lcdif: Fix use-after-free on unbind
Date: Mon, 23 Nov 2026 11:23:36 +0200	[thread overview]
Message-ID: <awQFcyLF3u3Z8_f_@vm> (raw)
In-Reply-To: <20260909210213.946159-1-festevam@gmail.com>

Hi Fabio,

On Wed, Sep 09, 2026 at 06:02:13PM -0300, Fabio Estevam wrote:
> lcdif allocates its private data, which embeds the CRTC and primary
> plane, and its encoders using devres. These DRM objects are linked into
> the mode_config lists.
> 
> Since mode_config cleanup is DRM-managed, it is deferred until the DRM
> device is released. An open DRM file can keep the DRM device alive after
> the platform device has been unbound and devres has freed those objects.
> The later mode_config cleanup then dereferences freed memory.
> 
> Allocate the private data with drmm before initializing mode_config so
> that it remains alive until mode_config cleanup has completed. Allocate
> encoders with drmm_plain_encoder_alloc(), which cleans up each encoder
> and removes it from the mode_config list before freeing its memory.
> 
> This can be reproduced on i.MX8MP by keeping the DRM card open across an
> LCDIF unbind and closing it afterwards.
> 
> Cc: stable@vger.kernel.org
> Fixes: 1c71d925c03a ("drm: lcdif: Switch to drmm_mode_config_init")
> Signed-off-by: Fabio Estevam <festevam@gmail.com>

Just a heads-up, this patch will not apply on latest linux-next. Probably
because devm_kzalloc() was swapped for devm_kzalloc_obj() in latest tree. So,
you may need to send a v2 anyway.

But other than that,
Reviewed-by: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

-- 
Thanks,
Laurentiu

      parent reply	other threads:[~2026-11-23  9:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09 21:02 [PATCH] drm/mxsfb: lcdif: Fix use-after-free on unbind Fabio Estevam
2026-11-20 21:15 ` Fabio Estevam
2026-11-23  9:23 ` Laurentiu Palcu [this message]

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=awQFcyLF3u3Z8_f_@vm \
    --to=laurentiu.palcu@oss.nxp.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=marex@denx.de \
    --cc=mripard@kernel.org \
    --cc=stable@vger.kernel.org \
    /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