diff options
| author | Nick Spooner <nicholas.spooner@seagate.com> | 2026-11-13 08:19:29 -0700 |
|---|---|---|
| committer | Niklas Cassel <cassel@kernel.org> | 2026-11-16 18:38:41 +0100 |
| commit | 9016b8b9e80d3d340b4ad83d457501e944834538 (patch) | |
| tree | d3cef76cfdf6b4c2c75dd6a09842ce29a3872aaf /rust/kernel/alloc/allocator | |
| parent | a4845f077415ef32fe672c841e2fc58ae9e28273 (diff) | |
ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE ELEMENT AND TRUNCATE
ata_scsi_remove_element_and_truncate_xlat() copies the REQUESTED CAPACITY
field, req_capacity, to REQUESTED MAX LBA for every block count except 1.
However, SAT-6 specifies that if REQUESTED CAPACITY is greater than one,
the REQUESTED MAX LBA shall be set to REQUESTED CAPACITY minus one, since
the max LBA = count - 1 (see SAT-6 rev2, 9.16.1, Table 74). For example, if
a capacity C > 1 is requested, the capacity ends up one block larger if the
drive can provide C + 1. If the drive can provide C but not C + 1, a
request that should be valid is instead rejected with INVALID FIELD IN CDB
(see ACS-5 rev10, 7.33.3.3).
Modify ata_scsi_remove_element_and_truncate_xlat() to decrement
req_capacity, except when equal to 1 or 0 (rejected if 1, let the device
choose if 0).
Tested by issuing sg_rem_rest_elem on a Seagate drive ST32000NM001F,
firmware db02 and checking the taskfile.
Fixes: db496721cb0d ("ata: libata-scsi: add support for the REMOVE ELEMENT AND TRUNCATE command")
Cc: stable@vger.kernel.org
Signed-off-by: Nick Spooner <nicholas.spooner@seagate.com>
Link: https://lore.kernel.org/r/20261113151929.9586-1-nicholas.spooner@seagate.com
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Diffstat (limited to 'rust/kernel/alloc/allocator')
0 files changed, 0 insertions, 0 deletions
