CVE-2023-53854

Source
https://cve.org/CVERecord?id=CVE-2023-53854
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-53854.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2023-53854
Downstream
Published
2025-12-09T01:30:19.746Z
Modified
2026-04-02T09:45:27.943880Z
Summary
ASoC: mediatek: mt8186: Fix use-after-free in driver remove path
Details

In the Linux kernel, the following vulnerability has been resolved:

ASoC: mediatek: mt8186: Fix use-after-free in driver remove path

When devm runs function in the "remove" path for a device it runs them in the reverse order. That means that if you have parts of your driver that aren't using devm or are using "roll your own" devm w/ devmaddactionorreset() you need to keep that in mind.

The mt8186 audio driver didn't quite get this right. Specifically, in mt8186initclock() it called mt8186audsysclkregister() and then went on to call a bunch of other devm function. The caller of mt8186initclock() used devmaddactionorreset() to call mt8186deinit_clock() but, because of the intervening devm functions, the order was wrong.

Specifically at probe time, the order was: 1. mt8186audsysclkregister() 2. afepriv->clk = devmkcalloc(...) 3. afepriv->clk[i] = devmclkget(...)

At remove time, the order (which should have been 3, 2, 1) was: 1. mt8186audsysclkunregister() 3. Free all of afepriv->clk[i] 2. Free afe_priv->clk

The above seemed to be causing a use-after-free. Luckily, it's easy to fix this by simply using devm more correctly. Let's move the devmaddactionorreset() to the right place. In addition to fixing the use-after-free, code inspection shows that this fixes a leak (missing call to mt8186audsysclkunregister()) that would have happened if any of the sysconregmaplookupbyphandle() calls in mt8186init_clock() had failed.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53854.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
55b423d5623ccd6785429431c2cf5f3e073b73ba
Fixed
3e56a1c04882852e3e7d6c59756a16211ebbc457
Fixed
dffd9e2b57cb845930fa885aa634a847ba2130dd
Fixed
a93d2afd3f77a7331271a0f25c6a11003db69b3c

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-53854.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.0.0
Fixed
6.1.30
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.3.4

Database specific

source
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-53854.json"