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"
[
{
"id": "CVE-2023-53658-02b52950",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@32b9c8f7892c19f7f5c9fed5fb410b9fd5990bb6",
"digest": {
"function_hash": "98698905087858807143975947330217131774",
"length": 4333.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-07a1f677",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d3dcdb43c872a3b967345144151a2c9bb9124c9b",
"digest": {
"function_hash": "113420233918895880160562345077689317946",
"length": 4345.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-091f256e",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a91c34357afcfaa5307e254f22a8452550a07b34",
"digest": {
"function_hash": "181575989708708394005023680212311412850",
"length": 3948.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-09b26ffe",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@398e6a015877d44327f754aeb48ff3354945c78c",
"digest": {
"function_hash": "177607910866241906526634902991004684660",
"length": 3870.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-0cf643d0",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a91c34357afcfaa5307e254f22a8452550a07b34",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-1de9d7ec",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c1f23ad34fcdace50275a6aa1e1969b41c6233f",
"digest": {
"function_hash": "113420233918895880160562345077689317946",
"length": 4345.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-1e8c8d0e",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22ae32d80ef590d12a2364e4621f90f7c58445c7",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-2bacae58",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d20db3c58a7f9361e370a7850ceb60dbdf62eea3",
"digest": {
"function_hash": "107156929766954933491833961557638085147",
"length": 3940.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-528c4b04",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@398e6a015877d44327f754aeb48ff3354945c78c",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-761193e8",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d20db3c58a7f9361e370a7850ceb60dbdf62eea3",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-7744c854",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@217b6ea8cf7b819477bca597a6ae2d43d38ba283",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-7fab9585",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@7c1f23ad34fcdace50275a6aa1e1969b41c6233f",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-aa47e20a",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@217b6ea8cf7b819477bca597a6ae2d43d38ba283",
"digest": {
"function_hash": "98698905087858807143975947330217131774",
"length": 4333.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-b19faab1",
"target": {
"function": "bcm_qspi_probe",
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@22ae32d80ef590d12a2364e4621f90f7c58445c7",
"digest": {
"function_hash": "113420233918895880160562345077689317946",
"length": 4345.0
},
"signature_type": "Function"
},
{
"id": "CVE-2023-53658-d4ffb774",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d3dcdb43c872a3b967345144151a2c9bb9124c9b",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
},
{
"id": "CVE-2023-53658-eee88558",
"target": {
"file": "drivers/spi/spi-bcm-qspi.c"
},
"signature_version": "v1",
"deprecated": false,
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@32b9c8f7892c19f7f5c9fed5fb410b9fd5990bb6",
"digest": {
"threshold": 0.9,
"line_hashes": [
"120047109239958806589517734201461814349",
"33503595266286911242714900899330073456",
"217074955597545004270082485213602462478",
"31075403474360094760984781773287095855",
"85259520430503398325161082649343136224",
"10512371859789755602210924380069148812",
"287267027059549445113273853338290000983",
"319799991767903497155943993089759942714",
"227051117701906226851605019058252226688",
"51484827133623309105732571222332300376"
]
},
"signature_type": "Line"
}
]