From: Maxime Ripard <mripard@kernel.org>
To: Karl Mehltretter <kmehltretter@gmail.com>
Cc: "Dave Stevenson" <dave.stevenson@raspberrypi.com>,
"Maíra Canal" <mcanal@igalia.com>,
"Raspberry Pi Kernel Maintenance" <kernel-list@raspberrypi.com>,
"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
"Thomas Zimmermann" <tzimmermann@suse.de>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/vc4: hdmi: Unregister the ASoC card on unbind
Date: Mon, 24 Aug 2026 08:52:44 +0200 [thread overview]
Message-ID: <20260824-expert-sepia-oyster-cabaea@houat> (raw)
In-Reply-To: <20260822143218.68764-1-kmehltretter@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1001 bytes --]
On Sat, Aug 22, 2026 at 04:32:18PM +0200, Karl Mehltretter wrote:
> vc4_hdmi, including the embedded ASoC card, is DRM-managed and freed
> together with the DRM device when the aggregate device is torn down.
> The card however is registered device-managed on the HDMI platform
> device, whose release runs later
Not necessarily, no. The comment you removed explained it. DRM-managed
memory isn't removed when the device in unbound/removed, but when it has
been and the last fd to the device file has been closed to userspace.
> so snd_soc_unregister_card() operates on freed memory:
>
> # modprobe vc4; rmmod vc4
> BUG: KASAN: slab-use-after-free in snd_soc_unregister_card
> Read of size 1 at addr ffff0000456a8450 by task rmmod/262
> Allocated by task 171: drmm_kmalloc / vc4_hdmi_bind
> Freed by task 262 (rmmod): drm_managed_release / drm_dev_put
And that happens only because you have no user. If you had one, you
would have had the opposite sequence.
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 273 bytes --]
next prev parent reply other threads:[~2026-08-24 6:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 14:32 Karl Mehltretter
2026-08-24 6:52 ` Maxime Ripard [this message]
2026-08-25 6:26 ` Karl Mehltretter
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=20260824-expert-sepia-oyster-cabaea@houat \
--to=mripard@kernel.org \
--cc=airlied@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel-list@raspberrypi.com \
--cc=kmehltretter@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mcanal@igalia.com \
--cc=simona@ffwll.ch \
--cc=tzimmermann@suse.de \
/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
all inboxes | Powered by JetHome®