In the Linux kernel, the following vulnerability has been resolved:
ASoC: sprd: validate compress buffer sizes against fixed allocations
sprd_platform_compr_open() allocates the stage 0 IRAM buffer (32K data
area) and the stage 1 DDR buffer (2M data area) with fixed sizes, but
sprd_platform_compr_copy() derives all copy lengths from the user
controlled runtime->fragment_size and the write() count, never
comparing them against the physical buffer sizes. The compress core
only checks fragment_size * fragments for an u32 overflow in
snd_compress_check_input(), so a local user can configure a logical
buffer of up to ~4GB via SNDRV_COMPRESS_SET_PARAMS, far exceeding the
fixed allocations.
A fragment_size larger than the 32K IRAM data area makes the stage 0
copy_from_user() overflow past the IRAM allocation, and a buffer_size
larger than the 2M DDR buffer makes the wrapping copy at the end of
sprd_platform_compr_copy() write fully user controlled data past the
buffer. No SNDRV_PCM_TRIGGER_START is needed, a write() in SETUP
state reaches the copy callback directly.
Reject parameters that do not fit into the fixed buffers in
set_params(), and fix the advertised max fragment size: 128K never
fitted into the 32K IRAM buffer. The caps values may have been carried over
from the qdsp6 driver, which allocates its buffers according to the
advertised maxima, unlike this driver. With 32K as max fragment size
the advertised limits are self-consistent: 32K * 64 = 2M equals the
DDR buffer size.
Discovered by Atuin - Automated Vulnerability Discovery Engine.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - The bad values come from a local process holding an open /dev/snd/comprCxDy node. It sets fragment_size/fragments with the SNDRV_COMPRESS_SET_PARAMS ioctl and picks the count in write() (snd_compr_write -> sprd_platform_compr_copy). No remote protocol carries this data.
AC:L - snd_compress_check_input() only checks fragment_size*fragments for u32 overflow, and before the fix sprd_platform_compr_set_params() had no size check at all. The attacker picks fragment_size >32K or a buffer >2M, then write()s in SETUP state, and the overflow happens every time. There is no race and nothing depends on hardware state.
PR:L - Opening the compress offload node needs only the ordinary device-file access given to audio clients: the audio group on Unisoc Android builds, or the seat user's uaccess ACL on generic Linux. No capability is checked along set_params or write.
UI:N - The attacker opens the device, sets parameters and writes data entirely on their own. No other user has to do anything.
S:U - A kernel memory overflow reached from a local process stays inside the kernel's own security authority. No VM, IOMMU or sandbox boundary is crossed.
C:H - copy_from_user() writes fully controlled data past the 32K IRAM area or the 2M+1K DDR compr_buffer, and the length is also controlled. That corrupts adjacent kernel memory, which is enough to build a read primitive and leak kernel data.
I:H - In sprd_platform_compr_copy(), both the stage 0 copy (fragment_size - received_stage0 past iram_buffer) and the wrapping DDR copy (data_count - avail_bytes into compr_buffer.area) write attacker data of attacker-chosen length past a fixed allocation. That is an out-of-bounds write that can lead to privilege escalation.
A:H - Overwriting the DMA link lists, the DSP playinfo area or neighbouring pages with megabytes of attacker data reliably crashes the kernel or the audio DSP. A single write() is enough.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - The bad values come from a local process holding an open /dev/snd/comprCxDy node. It sets fragment_size/fragments with the SNDRV_COMPRESS_SET_PARAMS ioctl and picks the count in write() (snd_compr_write -> sprd_platform_compr_copy). No remote protocol carries this data.
AC:L - snd_compress_check_input() only checks fragment_size*fragments for u32 overflow, and before the fix sprd_platform_compr_set_params() had no size check at all. The attacker picks fragment_size >32K or a buffer >2M, then write()s in SETUP state, and the overflow happens every time. There is no race and nothing depends on hardware state.
PR:L - Opening the compress offload node needs only the ordinary device-file access given to audio clients: the audio group on Unisoc Android builds, or the seat user's uaccess ACL on generic Linux. No capability is checked along set_params or write.
UI:N - The attacker opens the device, sets parameters and writes data entirely on their own. No other user has to do anything.
S:U - A kernel memory overflow reached from a local process stays inside the kernel's own security authority. No VM, IOMMU or sandbox boundary is crossed.
C:H - copy_from_user() writes fully controlled data past the 32K IRAM area or the 2M+1K DDR compr_buffer, and the length is also controlled. That corrupts adjacent kernel memory, which is enough to build a read primitive and leak kernel data.
I:H - In sprd_platform_compr_copy(), both the stage 0 copy (fragment_size - received_stage0 past iram_buffer) and the wrapping DDR copy (data_count - avail_bytes into compr_buffer.area) write attacker data of attacker-chosen length past a fixed allocation. That is an out-of-bounds write that can lead to privilege escalation.
A:H - Overwriting the DMA link lists, the DSP playinfo area or neighbouring pages with megabytes of attacker data reliably crashes the kernel or the audio DSP. A single write() is enough.
CVSS 3.1