linux/drivers/nvme
Hari Mishal bc7f75eba5 nvmet: passthru: fix OOB reads when parsing ns id descriptor list
nvmet_passthru_override_id_descs() walks a namespace identification
descriptor list populated from the underlying passthru controller's
Identify response, which is device reported. The loop advanced pos by
device controlled amounts (sizeof(*cur) + nidl) without checking that
the next descriptor header actually fits inside the buffer, so a
malicious device could push pos to within a few bytes of the buffer end
and cause cur->nidl, cur->nidt or the reserved field to be read past the
allocation.

Additionally, when a CSI descriptor lands exactly at the last valid
header offset, cur + 1 points one byte past the end of the buffer.
The unconditional memcpy(&csi, cur + 1, NVME_NIDT_CSI_LEN) could read
that out-of-bounds byte and copy it back to the initiator via
nvmet_copy_to_sgl(), leaking adjacent heap memory.

Bounds check both the descriptor header and the CSI value before
dereferencing them.

Signed-off-by: Hari Mishal <harimishal1@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
History 2026-08-10 11:51:24 -07:00
..
common nvme-auth: Avoid C=1 warning in nvme_auth_derive_tls_psk() 2026-07-06 11:28:31 -07:00
host nvme-pci: return error when parsing a quirk string fails 2026-07-29 08:08:01 -07:00
target nvmet: passthru: fix OOB reads when parsing ns id descriptor list 2026-08-10 11:51:24 -07:00
Kconfig nvme: implement In-Band authentication 2022-08-02 17:14:49 -06:00
Makefile nvme: common: make keyring and auth separate modules 2023-11-07 10:05:15 -08:00