diff options
| author | Andrea Parri <parri.andrea@gmail.com> | 2026-10-22 15:29:33 +0200 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-10-28 08:11:20 -0700 |
| commit | 9fb4adbc39751697b9fcf71e45bd5d5119c3f07c (patch) | |
| tree | 1e2f4fb1ef4ccce3de5cf13f29055b1f5d038c86 /tools/lib/python/kdoc/python_version.py | |
| parent | 46ed7310a60029826eedb01081a4556643ed5f3b (diff) | |
nvmet: pci-epf: require SGLs to match the command data length
The PCI endpoint target sends the host every byte a read command's SGL
describes, even when the SGL describes more than the command transfers.
The excess is kmalloc() memory the command never wrote, so the host
receives stale target memory. Any successful read can do this,
including Identify.
nvmet_pci_epf_alloc_iod_data_buf() allocates each segment at the length
of its SGL data descriptor, but sets req->transfer_len from
iod->data_len, the length the command implies. Once the command
completes, nvmet_pci_epf_transfer_iod_data() sends every segment in
full. Nothing compares the descriptor lengths with iod->data_len, and
the MDTS check only bounds iod->data_len.
Fail the command with Data SGL Length Invalid when the data descriptors
do not add up to iod->data_len, before any segment is allocated. The
tcp and rdma transports take the data length from the SGL itself, so
there most commands already reject a mismatch in
nvmet_check_transfer_len(). PRP lists are built from iod->data_len and
are unaffected.
Found by code inspection.
Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver")
Cc: stable@vger.kernel.org
Tested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
