diff options
| author | Shao Mingyin <shao.mingyin@zte.com.cn> | 2026-11-04 03:07:27 +0800 |
|---|---|---|
| committer | Keith Busch <kbusch@kernel.org> | 2026-11-05 08:53:01 -0800 |
| commit | cf399d4abbeddc317f8160a79fefb4016c469862 (patch) | |
| tree | 4e82fd3db3751cac5f1950f57c58bfe1aabf958a /tools/perf/scripts/python/Perf-Trace-Util/lib | |
| parent | 6d7388d1097f6b2367026114ce8d9e7b8b9d3426 (diff) | |
nvmet: bound the traddr and trsvcid configfs writes
nvmet_addr_traddr_store() and nvmet_addr_trsvcid_store() reject a write
only when count is larger than NVMF_TRADDR_SIZE (256) respectively
NVMF_TRSVCID_SIZE (32). A write of exactly that many characters is
accepted, and the following
sscanf(page, "%s\n", port->disc_addr.traddr)
has no field width. configfs terminates the buffer at page[count], so
the scan writes 256 characters plus the trailing NUL, i.e. 257 bytes,
into traddr[256]. The extra byte lands in the following tsas field of
the discovery log entry, silently clearing the first TSAS byte (the
RDMA queue type, or the TLS section type for TCP). trsvcid has the
same off-by-one with a 32-byte write; there the extra byte lands in
the reserved bytes that follow trsvcid.
Limit the scans to one byte less than the destination arrays. The
count checks can stay as they are so that a normal newline-terminated
write is still accepted.
Fixes: 9ba2a5cb8896 ("nvmet: filter newlines from user input")
Cc: stable@vger.kernel.org
Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/Perf-Trace-Util/lib')
0 files changed, 0 insertions, 0 deletions
