{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2021-47282",
        "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "state": "PUBLISHED",
        "assignerShortName": "Linux",
        "dateReserved": "2024-05-21T13:27:52.128Z",
        "datePublished": "2024-05-21T14:20:08.155Z",
        "dateUpdated": "2026-08-05T08:47:04.965Z"
    },
    "containers": {
        "cna": {
            "providerMetadata": {
                "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
                "shortName": "Linux",
                "dateUpdated": "2026-08-05T08:47:04.965Z"
            },
            "descriptions": [
                {
                    "lang": "en",
                    "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nspi: bcm2835: Fix out-of-bounds access with more than 4 slaves\n\nCommit 571e31fa60b3 (\"spi: bcm2835: Cache CS register value for\n->prepare_message()\") limited the number of slaves to 3 at compile-time.\nThe limitation was necessitated by a statically-sized array prepare_cs[]\nin the driver private data which contains a per-slave register value.\n\nThe commit sought to enforce the limitation at run-time by setting the\ncontroller's num_chipselect to 3:  Slaves with a higher chipselect are\nrejected by spi_add_device().\n\nHowever the commit neglected that num_chipselect only limits the number\nof *native* chipselects.  If GPIO chipselects are specified in the\ndevice tree for more than 3 slaves, num_chipselect is silently raised by\nof_spi_get_gpio_numbers() and the result are out-of-bounds accesses to\nthe statically-sized array prepare_cs[].\n\nAs a bandaid fix which is backportable to stable, raise the number of\nallowed slaves to 24 (which \"ought to be enough for anybody\"), enforce\nthe limitation on slave ->setup and revert num_chipselect to 3 (which is\nthe number of native chipselects supported by the controller).\nAn upcoming for-next commit will allow an arbitrary number of slaves."
                }
            ],
            "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 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.\nAC: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.\nPR: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.\nUI:N - No separate victim action is required; registration at probe and subsequent SPI I/O invoke the vulnerable code without interactive user cooperation.\nS: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.\nC: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.\nI: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.\nA: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."
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "unaffected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/spi/spi-bcm2835.c"
                    ],
                    "versions": [
                        {
                            "version": "571e31fa60b3697d5db26140e16d5c45c51c9815",
                            "lessThan": "b5502580cf958b094f3b69dfe4eece90eae01fbc",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "571e31fa60b3697d5db26140e16d5c45c51c9815",
                            "lessThan": "82a8ffba54d31e97582051cb56ba1f988018681e",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "571e31fa60b3697d5db26140e16d5c45c51c9815",
                            "lessThan": "01415ff85a24308059e06ca3e97fd7bf75648690",
                            "status": "affected",
                            "versionType": "git"
                        },
                        {
                            "version": "571e31fa60b3697d5db26140e16d5c45c51c9815",
                            "lessThan": "13817d466eb8713a1ffd254f537402f091d48444",
                            "status": "affected",
                            "versionType": "git"
                        }
                    ]
                },
                {
                    "product": "Linux",
                    "vendor": "Linux",
                    "defaultStatus": "affected",
                    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
                    "programFiles": [
                        "drivers/spi/spi-bcm2835.c"
                    ],
                    "versions": [
                        {
                            "version": "5.4",
                            "status": "affected"
                        },
                        {
                            "version": "0",
                            "lessThan": "5.4",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.4.126",
                            "lessThanOrEqual": "5.4.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.10.44",
                            "lessThanOrEqual": "5.10.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.12.11",
                            "lessThanOrEqual": "5.12.*",
                            "status": "unaffected",
                            "versionType": "semver"
                        },
                        {
                            "version": "5.13",
                            "lessThanOrEqual": "*",
                            "status": "unaffected",
                            "versionType": "original_commit_for_fix"
                        }
                    ]
                }
            ],
            "cpeApplicability": [
                {
                    "nodes": [
                        {
                            "operator": "OR",
                            "negate": false,
                            "cpeMatch": [
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.4",
                                    "versionEndExcluding": "5.4.126"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.4",
                                    "versionEndExcluding": "5.10.44"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.4",
                                    "versionEndExcluding": "5.12.11"
                                },
                                {
                                    "vulnerable": true,
                                    "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                                    "versionStartIncluding": "5.4",
                                    "versionEndExcluding": "5.13"
                                }
                            ]
                        }
                    ]
                }
            ],
            "references": [
                {
                    "url": "https://git.kernel.org/stable/c/b5502580cf958b094f3b69dfe4eece90eae01fbc"
                },
                {
                    "url": "https://git.kernel.org/stable/c/82a8ffba54d31e97582051cb56ba1f988018681e"
                },
                {
                    "url": "https://git.kernel.org/stable/c/01415ff85a24308059e06ca3e97fd7bf75648690"
                },
                {
                    "url": "https://git.kernel.org/stable/c/13817d466eb8713a1ffd254f537402f091d48444"
                }
            ],
            "title": "spi: bcm2835: Fix out-of-bounds access with more than 4 slaves",
            "x_generator": {
                "engine": "bippy-1.2.0"
            }
        },
        "adp": [
            {
                "title": "CISA ADP Vulnrichment",
                "metrics": [
                    {
                        "other": {
                            "type": "ssvc",
                            "content": {
                                "id": "CVE-2021-47282",
                                "role": "CISA Coordinator",
                                "options": [
                                    {
                                        "Exploitation": "none"
                                    },
                                    {
                                        "Automatable": "no"
                                    },
                                    {
                                        "Technical Impact": "partial"
                                    }
                                ],
                                "version": "2.0.3",
                                "timestamp": "2024-05-23T17:10:17.644618Z"
                            }
                        }
                    }
                ],
                "providerMetadata": {
                    "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0",
                    "shortName": "CISA-ADP",
                    "dateUpdated": "2024-06-04T17:14:52.641Z"
                }
            },
            {
                "providerMetadata": {
                    "orgId": "af854a3a-2127-422b-91ae-364da2661108",
                    "shortName": "CVE",
                    "dateUpdated": "2024-08-04T05:32:08.008Z"
                },
                "title": "CVE Program Container",
                "references": [
                    {
                        "url": "https://git.kernel.org/stable/c/b5502580cf958b094f3b69dfe4eece90eae01fbc",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/82a8ffba54d31e97582051cb56ba1f988018681e",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/01415ff85a24308059e06ca3e97fd7bf75648690",
                        "tags": [
                            "x_transferred"
                        ]
                    },
                    {
                        "url": "https://git.kernel.org/stable/c/13817d466eb8713a1ffd254f537402f091d48444",
                        "tags": [
                            "x_transferred"
                        ]
                    }
                ]
            }
        ]
    }
}