diff options
| author | Niklas Cassel <cassel@kernel.org> | 2026-09-29 10:25:08 +0200 |
|---|---|---|
| committer | Martin K. Petersen (Oracle) <mkp@kernel.org> | 2026-10-03 10:14:30 -0400 |
| commit | b81608b17c5d04c797e6fc1cfb95182c842a4db9 (patch) | |
| tree | 9a734a6335df06180d16b0d7b017a9fb1545889a /tools/lib/python/kdoc/python_version.py | |
| parent | cb2d2a7c80c62d1e5e476609706f29dd9584d0e0 (diff) | |
| download | linux-next-b81608b17c5d04c797e6fc1cfb95182c842a4db9.tar.gz linux-next-b81608b17c5d04c797e6fc1cfb95182c842a4db9.zip | |
scsi: scsi_debug: Refuse a short WRITE ATOMIC (16) before writing it
A write whose data-out buffer is shorter than its transfer length is
short. An ordinary write transfers what the buffer holds and reports the
rest as a residual, but an atomic write cannot be short: SBC-6 r02 (T10/BSR
INCITS 587), 4.28.1, requires each atomic write operation to write either
all of its data or none of it, and 4.28.2 requires one that cannot complete
to leave the LBAs that it specifies unaltered.
resp_atomic_write() does fail a short WRITE ATOMIC (16) with DID_ERROR, but
only after do_device_access() has returned, and do_device_access() copies
one logical block at a time, so by then the blocks that the buffer did hold
have been written. An eight block WRITE ATOMIC (16) with a buffer of four
fails having overwritten the first four.
Check the length of the buffer before writing anything, and fail the
command with the same DID_ERROR as before.
Assisted-by: LLM
Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: John Garry <john.garry@linux.dev>
Fixes: 84f3a3c01d70 ("scsi: scsi_debug: Atomic write support")
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260929082456.857423-26-cassel@kernel.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
