nvmet-fc: fix invalid free in LS IOD error path
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ c53432030d86429dc9fe5adc3d68cb9d1343b0b2 · < 8bce9cd08aae4283badf8ddc11fbb6f57b75a81e| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
nvmet-fc: fix invalid free in LS IOD error path
nvmet_fc_alloc_ls_iodlist() advances iod while initializing the LS IOD array. If an rqstbuf allocation or response buffer DMA mapping fails, the unwind loop decrements iod past the start of the array. The final kfree(iod) therefore frees an address before the allocated object.
This can be reproduced with nvme-fcloop and failslab by setting fail-nth to 6 before creating a target port. KASAN reports:
BUG: KASAN: invalid-free in nvmet_fc_register_targetport Free of addr ffff88816cf8ff48 by task nvmet_fail_nth/9552
Free the original allocation base stored in tgtport->iod instead. With this fix applied, the same sysfs write with fail-nth=6 returns -ENOMEM without any KASAN report.
From the CVE record · Linux
The Linux kernel’s nvmet-fc target-port setup can free an address before an allocated object if a request-buffer allocation or response-buffer DMA mapping fails. The input does not establish an attacker path, authentication requirement, or user-interaction requirement.
Engineers running Linux kernels with nvmet-fc should check their vendor’s advisory; affected versions are not specified.