In the Linux kernel, the following vulnerability has been resolved:
spi: bcm-qspi: return error if neither hif_mspi nor mspi is available
If neither a "hifmspi" nor "mspi" resource is present, the driver will just early exit in probe but still return success. Apart from not doing anything meaningful, this would then also lead to a null pointer access on removal, as platformget_drvdata() would return NULL, which it would then try to dereference when trying to unregister the spi master.
Fix this by unconditionally calling devmioremapresource(), as it can handle a NULL res and will then return a viable ERR_PTR() if we get one.
The "return 0;" was previously a "goto qspiresourceerr;" where then ret was returned, but since ret was still initialized to 0 at this place this was a valid conversion in 63c5395bb7a9 ("spi: bcm-qspi: Fix use-after-free on unbind"). The issue was not introduced by this commit, only made more obvious.
{
"cna_assigner": "Linux",
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2023/53xxx/CVE-2023-53658.json"
}"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2023-53658.json"
[
{
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d3dcdb43c872a3b967345144151a2c9bb9124c9b",
"id": "CVE-2023-53658-07a1f677",
"deprecated": false,
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"digest": {
"length": 4345.0,
"function_hash": "113420233918895880160562345077689317946"
}
},
{
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d3dcdb43c872a3b967345144151a2c9bb9124c9b",
"id": "CVE-2023-53658-d4ffb774",
"deprecated": false,
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"digest": {
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
],
"threshold": 0.9
}
}
]