CVE-2021-47282
published high CVSS 3.1 · 7.8spi: bcm2835: Fix out-of-bounds access with more than 4 slaves
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| Linux | — | Linux571e31fa60b3697d5db26140e16d5c45c51c9815 to < b5502580cf958b094f3b69dfe4eece90eae01fbc · 571e31fa60b3697d5db26140e16d5c45c51c9815 to < 82a8ffba54d31e97582051cb56ba1f988018681e · 571e31fa60b3697d5db26140e16d5c45c51c9815 to < 01415ff85a24308059e06ca3e97fd7bf75648690 · 571e31fa60b3697d5db26140e16d5c45c51c9815 to < 13817d466eb8713a1ffd254f537402f091d48444 · Other versions: unaffected | Affected | Not stated | Linux |
| Linux | — | Linux5.4 (affected) · 0 to < 5.4 (unaffected · semver) · 5.4.126 through 5.4.* (unaffected · semver) · 5.10.44 through 5.10.* (unaffected · semver) · 5.12.11 through 5.12.* (unaffected · semver) · 5.13 and later (unaffected · original_commit_for_fix) · Other versions: affected | Version-specific | Not stated | Linux |
| Amazon Linux | AL2 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
| Amazon Linux | AL2023 | Release evaluation | Not Affected | Not required | Amazon Linux assessment |
Description
In the Linux kernel, the following vulnerability has been resolved: spi: bcm2835: Fix out-of-bounds access with more than 4 slaves Commit 571e31fa60b3 ("spi: bcm2835: Cache CS register value for ->prepare_message()") limited the number of slaves to 3 at compile-time. The limitation was necessitated by a statically-sized array prepare_cs[] in the driver private data which contains a per-slave register value. The commit sought to enforce the limitation at run-time by setting the controller's num_chipselect to 3: Slaves with a higher chipselect are rejected by spi_add_device(). However the commit neglected that num_chipselect only limits the number of *native* chipselects. If GPIO chipselects are specified in the device tree for more than 3 slaves, num_chipselect is silently raised by of_spi_get_gpio_numbers() and the result are out-of-bounds accesses to the statically-sized array prepare_cs[]. As a bandaid fix which is backportable to stable, raise the number of allowed slaves to 24 (which "ought to be enough for anybody"), enforce the limitation on slave ->setup and revert num_chipselect to 3 (which is the number of native chipselects supported by the controller). An upcoming for-next commit will allow an arbitrary number of slaves.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- Linux · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Scenarios
- en: AV:L - The bcm2835 SPI host driver is reached through local device registration and SPI transfers (e.g. spidev or bound slave drivers) after the controller is instantiated from the platform/device tree; it is not reachable via network protocols or by merely attaching a hot-plugged peripheral. AC:L - Once more than four GPIO chipselects are present in the device tree, of_spi_get_gpio_numbers() raises num_chipselect and spi_add_device() accepts high CS indices, so bcm2835_spi_setup()/prepare_message()/DMA paths reliably perform the out-of-bounds accesses with no race or other attacker-uncontrollable condition. PR:L - On affected Raspberry Pi and industrial bcm2835 systems, unprivileged local users can open SPI device nodes and trigger transfers that exercise the OOB paths; DT configuration establishing the vulnerable CS count is a realistic deployment precondition rather than a requirement for high privileges at exploit time. UI:N - No separate victim action is required; registration at probe and subsequent SPI I/O invoke the vulnerable code without interactive user cooperation. S:U - The corruption is confined to kernel memory in the same SPI controller privilege domain and does not cross a VM, IOMMU, or other security authority boundary. C:H - Out-of-bounds reads of prepare_cs[] and adjacent bcm2835_spi fields, plus heap corruption from clear_rx_cs[] writes past the allocation, are memory-corruption primitives that can be leveraged for information disclosure. I:H - Out-of-bounds writes into prepare_cs[] (overwriting later struct fields such as pointers) and past clear_rx_cs[] into the heap, together with submission of invalid clear_rx_desc[] DMA descriptors, enable integrity compromise and control-flow/DMA abuse. A:H - Invalid pointer and DMA descriptor use from the corrupted bcm2835_spi state can cause kernel oops/panic or hangs, yielding a full availability impact.
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| Linux | Linux | 571e31fa60b3697d5db26140e16d5c45c51c9815 to < b5502580cf958b094f3b69dfe4eece90eae01fbc (affected · git)571e31fa60b3697d5db26140e16d5c45c51c9815 to < 82a8ffba54d31e97582051cb56ba1f988018681e (affected · git)571e31fa60b3697d5db26140e16d5c45c51c9815 to < 01415ff85a24308059e06ca3e97fd7bf75648690 (affected · git)571e31fa60b3697d5db26140e16d5c45c51c9815 to < 13817d466eb8713a1ffd254f537402f091d48444 (affected · git)Default: unaffected | Linux · cna |
| Linux | Linux | 5.4 (affected)0 to < 5.4 (unaffected · semver)5.4.126 through 5.4.* (unaffected · semver)5.10.44 through 5.10.* (unaffected · semver)5.12.11 through 5.12.* (unaffected · semver)5.13 and later (unaffected · original_commit_for_fix)Default: affected | Linux · cna |
Weaknesses
0No weakness assertions.
References
4Provider assertions
3Linux · cna
spi: bcm2835: Fix out-of-bounds access with more than 4 slaves
CISA-ADP · adp
CISA ADP Vulnrichment
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- 1bd99bbc6cb52554616fb3b24e313e63aa7f17e4d1ee131c12fbcdfcdd23953d
- Ingested
- 23 Sep 2026, 07:57:11 UTC
- Source record
- Official CVE record