ASoC: SOF: ipc3-control: Fix TOCTOU in bytes_put and bytes_get
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 544ac8858f249950b4d99c68e538cdc07300528f · < 1f97760417b5faa60e9642fd0ed61eb17d0b1b39| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
ASoC: SOF: ipc3-control: Fix TOCTOU in bytes_put and bytes_get
In sof_ipc3_bytes_put(), the size used for the memcpy is derived from the old data->size already in the buffer, not the incoming new data's size field. If the new data has a different size, the copy length is wrong: it may truncate valid data or copy stale bytes.
Similarly, sof_ipc3_bytes_get() checks data->size against max_size without accounting for the sizeof(struct sof_ipc_ctrl_data) offset of the flex array within the allocation.
Fix bytes_put to validate and use the incoming data's sof_abi_hdr.size from ucontrol before copying. Fix bytes_get to subtract sizeof(*cdata) from the bounds check to match the actual available space.
From the CVE record · Linux
The Linux kernel’s ASoC SOF ipc3-control code uses an old size when copying incoming control data and incorrectly checks the bounds of data returned by bytes_get. An attacker who can supply control data with a different size may cause data to be truncated or stale bytes to be copied; the input does not specify whether network access, authentication, or user interaction is required.
Engineers running Linux kernels with ASoC SOF ipc3-control should check their versions against the vendor advisory; affected versions are not specified.