[PATCH 0/4] nvme: small fixes from a drivers/nvme audit

Guixin Liu kanie at linux.alibaba.com
Tue Dec 1 03:53:41 PST 2026


A static audit of drivers/nvme turned up a set of small, independent
bugs. This series collects four of them; each patch has its own
reproducer and regression run, described below the --- line.

  nvme: guard nvme_strlen() against all-space strings
    An all-space Identify field drives the length negative and reads
    before the buffer.

  nvme: trace the Set Features Save bit from the right position
    The trace parser reads reserved bit 27 instead of the SV bit 31.

  nvmet-fc: clear the DMA address of the fod that failed mapping
    The failing fod keeps DMA_MAPPING_ERROR and is later passed to
    dma_unmap_single().

  nvme-fcloop: initialize port structures before publishing them
    A concurrent port delete can flush an uninitialized work_struct
    and test an uninitialized list head.

Testing: QEMU/KVM guest, 7.3.0 kernel with KASAN, UBSAN and
CONFIG_DMA_API_DEBUG, nvmet-tcp and nvme-fcloop loopback. Each fix was
reproduced on the unpatched code, verified with the same recipe after
patching, and regression-tested with the test-only injections removed
(connect/IO/disconnect and normal add/delete paths, no warnings). The
test-only injections and the DMA_API_DEBUG kernel build live in the
test environment only, not in these patches.

Guixin Liu (4):
  nvme: guard nvme_strlen() against all-space strings
  nvme: trace the Set Features Save bit from the right position
  nvmet-fc: clear the DMA address of the fod that failed mapping
  nvme-fcloop: initialize port structures before publishing them

 drivers/nvme/host/nvme.h     |  2 +-
 drivers/nvme/host/trace.c    |  2 +-
 drivers/nvme/target/fc.c     |  1 +
 drivers/nvme/target/fcloop.c | 28 ++++++++++++++++++----------
 4 files changed, 21 insertions(+), 12 deletions(-)

-- 
2.43.7




More information about the Linux-nvme mailing list