In the Linux kernel, the following vulnerability has been resolved:
scsi: megaraid_sas: Limit NVMe request size to the PRP chain frame
megasas_make_prp_nvme() builds a command's PRP list in cmd->sg_frame, a
DMA pool buffer of instance->max_chain_frame_sz bytes, spending one
entry per NVMe page of the transfer plus one per page of the buffer for
the chain pointer. The loop runs until the transfer is described and
never checks the buffer bound.
max_hw_sectors comes straight from the MDTS the firmware reports for the
drive. On drives with a large MDTS the only thing keeping the list
inside the buffer was the block layer default of 1280 KiB, which needs
320 entries, which fit into a 4 KiB frame as that holds 512. But since
commit 9b8b84879d4a ("block: Increase BLK_DEF_MAX_SECTORS_CAP") that
default is 4 MiB, and such a transfer needs 1025 entries, so the list
runs a full page past the end of the frame:
sd 1:0:1:0: [sdb] tag#630 page boundary ptr_sgl: 0x00000000ba62d13f
BUG: unable to handle page fault for address: ff663bcb81e7c000
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
RIP: 0010:megasas_build_and_issue_cmd_fusion+0xeaa/0x1870 [megaraid_sas]
If the page after the frame happens to be mapped, the overrun does not
fault but silently corrupts the neighbouring pool entry, which is
another in-flight command's PRP list.
Cap max_hw_sectors at what the chain frame can describe, less one page
for transfers that do not start on a page boundary and so need one entry
more. This is the megaraid_sas counterpart of commit 04631f55afc5
("scsi: mpt3sas: Limit NVMe request size to 2 MiB"), but derives the
limit from max_chain_frame_sz rather than hardcoding it.
CVSS Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7.8
AV:L - The overflow is in megaraid_sas while building NVMe PRP lists for SCSI commands from the local block layer (queuecommand → megasas_build_and_issue_cmd_fusion → megasas_make_prp_nvme); the HBA driver is not bound to the network stack.
AC:L - On MegaRAID NVMe Fast Path with a firmware MDTS above the 4 KiB chain-frame capacity, a single 4 MiB I/O (the post-6.17 block-layer default) drives the unbounded PRP loop past cmd->sg_frame with no race or other condition outside the attacker’s control.
PR:L - An unprivileged local user who can read or write a file or block device on the NVMe-backed volume can submit a large O_DIRECT or sequential I/O that the block layer issues as one request; the megaraid ioctl CAP_SYS_ADMIN check is not on this path.
UI:N - The attacker triggers the overflow directly by submitting their own I/O; no separate victim action is required.
S:U - The out-of-bounds write corrupts host-kernel DMA-pool memory of the same HBA; it is not a VM escape, IOMMU bypass, or other cross-authority impact.
C:H - The write overruns the PRP chain frame into the neighbouring dma_pool object, another in-flight command’s PRP list, so DMA can be redirected to attacker-controlled buffers and disclose other I/O or kernel memory.
I:H - This is an unbounded out-of-bounds write of DMA addresses past a fixed-size sg_frame, corrupting adjacent kernel/DMA-pool memory and enabling integrity violation and control-flow or DMA hijacking.
A:H - When the page after the frame is unmapped the overrun causes a kernel page-fault oops in megasas_build_and_issue_cmd_fusion, as documented in the fix; neighbouring-command corruption can also panic or hang the host.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - The overflow is in megaraid_sas while building NVMe PRP lists for SCSI commands from the local block layer (queuecommand → megasas_build_and_issue_cmd_fusion → megasas_make_prp_nvme); the HBA driver is not bound to the network stack.
AC:L - On MegaRAID NVMe Fast Path with a firmware MDTS above the 4 KiB chain-frame capacity, a single 4 MiB I/O (the post-6.17 block-layer default) drives the unbounded PRP loop past cmd->sg_frame with no race or other condition outside the attacker’s control.
PR:L - An unprivileged local user who can read or write a file or block device on the NVMe-backed volume can submit a large O_DIRECT or sequential I/O that the block layer issues as one request; the megaraid ioctl CAP_SYS_ADMIN check is not on this path.
UI:N - The attacker triggers the overflow directly by submitting their own I/O; no separate victim action is required.
S:U - The out-of-bounds write corrupts host-kernel DMA-pool memory of the same HBA; it is not a VM escape, IOMMU bypass, or other cross-authority impact.
C:H - The write overruns the PRP chain frame into the neighbouring dma_pool object, another in-flight command’s PRP list, so DMA can be redirected to attacker-controlled buffers and disclose other I/O or kernel memory.
I:H - This is an unbounded out-of-bounds write of DMA addresses past a fixed-size sg_frame, corrupting adjacent kernel/DMA-pool memory and enabling integrity violation and control-flow or DMA hijacking.
A:H - When the page after the frame is unmapped the overrun causes a kernel page-fault oops in megasas_build_and_issue_cmd_fusion, as documented in the fix; neighbouring-command corruption can also panic or hang the host.
CVSS 3.1