{"id":"CVE-2025-40045","state":"PUBLISHED","title":"ASoC: codecs: wcd937x: set the comp soundwire port correctly","description":"In the Linux kernel, the following vulnerability has been resolved:\n\nASoC: codecs: wcd937x: set the comp soundwire port correctly\n\nFor some reason we endup with setting soundwire port for\nHPHL_COMP and HPHR_COMP as zero, this can potentially result\nin a memory corruption due to accessing and setting -1 th element of\nport_map array.","publishedAt":"2025-10-28T11:48:23.431Z","updatedAt":"2026-08-05T12:07:18.382Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"abcd537aae3b84c6d10ad147e99a204bcb56b234","versionType":"git"},{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"1a1ca38392e7e896075afc8905ddaea525ed30f7","versionType":"git"},{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"66a940b1bf48a7095162688332d725ba160154eb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["sound/soc/codecs/wcd937x.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.11","versionType":"semver"},{"version":"6.12.53","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.3","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["sound/soc/codecs/wcd937x.c"]}],"references":["https://git.kernel.org/stable/c/abcd537aae3b84c6d10ad147e99a204bcb56b234","https://git.kernel.org/stable/c/1a1ca38392e7e896075afc8905ddaea525ed30f7","https://git.kernel.org/stable/c/66a940b1bf48a7095162688332d725ba160154eb"],"weaknesses":[],"ingestedAt":"2026-10-29T20:09:09.358Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2025/40xxx/CVE-2025-40045.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-40045","state":"PUBLISHED","datePublished":"2025-10-28T11:48:23.431Z","dateUpdated":"2026-08-05T12:07:18.382Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2025-04-16T07:20:57.154Z"},"containers":{"cna":{"title":"ASoC: codecs: wcd937x: set the comp soundwire port correctly","descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nASoC: codecs: wcd937x: set the comp soundwire port correctly\n\nFor some reason we endup with setting soundwire port for\nHPHL_COMP and HPHR_COMP as zero, this can potentially result\nin a memory corruption due to accessing and setting -1 th element of\nport_map array."}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"abcd537aae3b84c6d10ad147e99a204bcb56b234","versionType":"git"},{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"1a1ca38392e7e896075afc8905ddaea525ed30f7","versionType":"git"},{"version":"82be8c62a38c6a44e64ecb29d7a9b5cb35c6cad4","status":"affected","lessThan":"66a940b1bf48a7095162688332d725ba160154eb","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["sound/soc/codecs/wcd937x.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.11","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.11","versionType":"semver"},{"version":"6.12.53","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.17.3","status":"unaffected","lessThanOrEqual":"6.17.*","versionType":"semver"},{"version":"6.18","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["sound/soc/codecs/wcd937x.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/abcd537aae3b84c6d10ad147e99a204bcb56b234"},{"url":"https://git.kernel.org/stable/c/1a1ca38392e7e896075afc8905ddaea525ed30f7"},{"url":"https://git.kernel.org/stable/c/66a940b1bf48a7095162688332d725ba160154eb"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The vulnerable code is reached only through an ALSA control-element write ioctl (SNDRV_CTL_IOCTL_ELEM_WRITE) on /dev/snd/controlC*, which requires local access to the device node. There is no network or remote-peer input path into wcd937x_set_compander().\nAC:L - A single ioctl writing a toggled value to \"HPHL_COMP Switch\" or \"HPHR_COMP Switch\" deterministically drives mc->reg == -1 into the ch_info[] index and the u8 truncation to 255, with no race, timing window, or unpredictable precondition. The out-of-bounds indices and written values derive from fixed module .data content, so they are identical on every boot of a given build.\nPR:L - No capability check exists on the path; the attacker only needs write access to the sound card's control node, which unprivileged desktop/embedded users hold via the audio group or logind ACLs and which the audio HAL holds on Android. Per the higher-severity rule this is Low rather than High.\nUI:N - The attacker performs the control write entirely on its own; no victim must open a file, mount anything, or interact with audio in any way. The codec controls are registered as soon as the WCD937x component probes.\nS:U - The out-of-bounds accesses corrupt kernel heap memory within the same kernel security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The path performs multiple unbounded reads — ch_info[-1], ch_info[255] roughly 3 KB past a 96-byte array, and sdw_slave->m_port_map[] indexed by an attacker-unbounded u8 — and the resulting heap out-of-bounds writes constitute memory corruption that can be leveraged for arbitrary read, so High applies.\nI:H - Two out-of-bounds writes occur past the small devm_kzalloc'd wcd937x_sdw_priv object (port_config[port_idx-1].num up to ~2 KB beyond, master_channel_map[mstr_port_num] up to ~1 KB beyond), corrupting adjacent slab objects with build-deterministic offsets — a heap write primitive suitable for control-flow hijacking.\nA:H - Out-of-bounds slab writes corrupt neighbouring allocations and readily produce KASAN reports, slab metadata damage, and kernel oops/panic; the far OOB read may also touch unmapped memory. Any kernel crash is scored High."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T12:07:18.382Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.12.53"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.17.3"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.11","versionEndExcluding":"6.18"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}}}}}