Skip to contentSkip to conversation

CVE-2026-31475: ASoC: sma1307: fix double free of devm_kzalloc() memory

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Apr 22

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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

ASoC: sma1307: fix double free of devm_kzalloc() memory

A previous change added NULL checks and cleanup for allocation failures in sma1307_setting_loaded().

However, the cleanup for mode_set entries is wrong. Those entries are allocated with devm_kzalloc(), so they are device-managed resources and must not be freed with kfree(). Manually freeing them in the error path can lead to a double free when devres later releases the same memory.

Drop the manual kfree() loop and let devres handle the cleanup.

The Linux kernel CVE team has assigned CVE-2026-31475 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 6.15 with commit 0ec6bd16705fe21d6429d6b8f7981eae2142bba8 and fixed in 6.18.21 with commit d472d1a52985211b92883bb64bbe710b45980190
	Issue introduced in 6.15 with commit 0ec6bd16705fe21d6429d6b8f7981eae2142bba8 and fixed in 6.19.11 with commit 1a82c3272626db9006f4c2cad3adf2916417aed6
	Issue introduced in 6.15 with commit 0ec6bd16705fe21d6429d6b8f7981eae2142bba8 and fixed in 7.0 with commit fe757092d2329c397ecb32f2bf68a5b1c4bd9193
	Issue introduced in 6.14.9 with commit f8434b8ba437d3f6cbcd9ffe8405bd16ed28fc5c

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-31475

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:

	sound/soc/codecs/sma1307.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/d472d1a52985211b92883bb64bbe710b45980190
	https://git.kernel.org/stable/c/1a82c3272626db9006f4c2cad3adf2916417aed6
	https://git.kernel.org/stable/c/fe757092d2329c397ecb32f2bf68a5b1c4bd9193