diff options
| author | Daehyeon Ko <4ncienth@gmail.com> | 2026-09-15 12:51:23 +0900 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-09-25 08:06:21 -0700 |
| commit | 5d5fbfbbacd1efb13a9bf91317d4fde859ede4b9 (patch) | |
| tree | 1176404add89a9d053a6cc2d225472ef48400042 /include/linux/timerqueue.h | |
| parent | 63fa2d9c9c37020bd2703fe2a6a38027b5abeb15 (diff) | |
| download | linux-next-5d5fbfbbacd1efb13a9bf91317d4fde859ede4b9.tar.gz linux-next-5d5fbfbbacd1efb13a9bf91317d4fde859ede4b9.zip | |
nvmet: pci-epf: reject too-short SGL segments
The host controls an SGL segment's length. A nonzero length smaller than
one SGL descriptor makes nr_descs zero, so
nvmet_pci_epf_get_sgl_segment() reads the type byte of sgls[-1] outside
the allocated buffer. If that byte contains a segment descriptor type,
the function also copies the preceding 16 bytes and returns a negative
descriptor count.
The read was reproduced in 3/3 KASAN boots with only the host transfer
mocked by a KUnit test:
BUG: KASAN: slab-out-of-bounds in nvmet_pci_epf_get_sgl_segment
Read of size 1 by task kunit_try_catch
Call Trace:
nvmet_pci_epf_get_sgl_segment
nvmet_pci_epf_short_sgl_test
Kernel panic - not syncing: KASAN: panic_on_warn set ...
Reject segments that cannot hold one descriptor before allocating or
transferring their contents.
Fixes: 0faa0fe6f90e ("nvmet: New NVMe PCI endpoint function target driver")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Daehyeon Ko <4ncienth@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'include/linux/timerqueue.h')
0 files changed, 0 insertions, 0 deletions
