FAILED: patch "[PATCH] ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE" failed to apply to 7.3-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 9016b8b9e80d3d340b4ad83d457501e944834538
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026120244-gooey-bunkmate-07d7@gregkh' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 9016b8b9e80d3d340b4ad83d457501e944834538 Mon Sep 17 00:00:00 2001
From: Nick Spooner <[email protected]>
Date: Fri, 13 Nov 2026 08:19:29 -0700
Subject: [PATCH] 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.
drivers/ata/libata-scsi.c +3 -0
@@ -4991,6 +4991,9 @@ ata_scsi_remove_element_and_truncate_xlat(struct ata_queued_cmd *qc)return 1 ; } +if (req_capacity >1 ) + req_capacity--; + id =get_unaligned_be32 (&cdb[10 ]); tf->protocol =ATA_PROT_NODATA ;
Sasha Levin
maintainerPATCH 1/1 ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE ELEMENT AND TRUNCATE
From: Nick Spooner <[email protected]>
[ Upstream commit 9016b8b9e80d3d340b4ad83d457501e944834538 ]
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.
--- drivers/ata/libata-scsi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/ata/libata-scsi.c +3 -0
@@ -4920,6 +4920,9 @@ ata_scsi_remove_element_and_truncate_xlat(struct ata_queued_cmd *qc)return 1 ; } +if (req_capacity >1 ) + req_capacity--; + id =get_unaligned_be32 (&cdb[10 ]); tf->protocol =ATA_PROT_NODATA ;
Signature · 1 line
2.53.0