In the Linux kernel, the following vulnerability has been resolved:
scsi: pm80xx: Fix array-index-out-of-of-bounds on rmmod
Since commit f7b705c238d1 ("scsi: pm80xx: Set phy_attached to zero when device is gone") UBSAN reports:
UBSAN: array-index-out-of-bounds in drivers/scsi/pm8001/pm8001sas.c:786:17 index 28 is out of range for type 'pm8001phy [16]'
on rmmod when using an expander.
For a direct attached device, attachedphy contains the local phy id. For a device behind an expander, attachedphy contains the remote phy id, not the local phy id.
I.e. while pm8001ha will have pm8001ha->chip->nphy local phys, for a device behind an expander, attachedphy can be much larger than pm8001ha->chip->nphy (depending on the amount of phys of the expander).
E.g. on my system pm8001_ha has 8 phys with phy ids 0-7. One of the ports has an expander connected. The expander has 31 phys with phy ids 0-30.
The pm8001ha->phy array only contains the phys of the HBA. It does not contain the phys of the expander. Thus, it is wrong to use attachedphy to index the pm8001_ha->phy array for a device behind an expander.
Thus, we can only clear phy_attached for devices that are directly attached.
[
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-09eca37f",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83ced3c206c292458e47c7fac54223abc7141585",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-0a8694a1",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d94be0a6ae9ade706d4270e740bdb4f79953a7fc",
"digest": {
"function_hash": "244344639912141738242032041759548390873",
"length": 755.0
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-20378ffe",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e62251954a128a2d0fcbc19e5fa39e08935bb628",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-6a97737a",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@45acbf154befedd9bc135f5e031fe7855d1e6493",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-79e0f757",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@eef5ef400893f8e3dbb09342583be0cdc716d566",
"digest": {
"function_hash": "72758585857479680976782963748676706273",
"length": 773.0
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-80c56849",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9c671d4dbfbfb0d73cfdfb706afb36d9ad60a582",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-822aa9e8",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@83ced3c206c292458e47c7fac54223abc7141585",
"digest": {
"function_hash": "283322881553148876603369034310675176829",
"length": 764.0
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-8b735a92",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@45acbf154befedd9bc135f5e031fe7855d1e6493",
"digest": {
"function_hash": "72758585857479680976782963748676706273",
"length": 773.0
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-9587dce2",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@251be2f6037fb7ab399f68cd7428ff274133d693",
"digest": {
"function_hash": "283322881553148876603369034310675176829",
"length": 764.0
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-a1823a52",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@eef5ef400893f8e3dbb09342583be0cdc716d566",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-c2cb349d",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@9c671d4dbfbfb0d73cfdfb706afb36d9ad60a582",
"digest": {
"function_hash": "283322881553148876603369034310675176829",
"length": 764.0
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-d05d4a37",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@251be2f6037fb7ab399f68cd7428ff274133d693",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"127085740309634405130968930915514648967"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Line",
"deprecated": false,
"id": "CVE-2025-40118-e4cca723",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d94be0a6ae9ade706d4270e740bdb4f79953a7fc",
"digest": {
"line_hashes": [
"335639088861372856347083116637232299100",
"291984732064220839497074127455050958786",
"305840281758919856617804356145219456960",
"273653003243025278300139353155357856369",
"288388621287135302304966771956729504173",
"183416554311724930172703956649527900042",
"252799418961609379088159442659849428549",
"275986531895114437532353967209971271662"
],
"threshold": 0.9
},
"signature_version": "v1"
},
{
"signature_type": "Function",
"deprecated": false,
"id": "CVE-2025-40118-e91b12f0",
"target": {
"file": "drivers/scsi/pm8001/pm8001_sas.c",
"function": "pm8001_dev_gone_notify"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e62251954a128a2d0fcbc19e5fa39e08935bb628",
"digest": {
"function_hash": "283322881553148876603369034310675176829",
"length": 764.0
},
"signature_version": "v1"
}
]