* FAILED: patch "[PATCH] ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE" failed to apply to 7.3-stable tree
@ 2026-12-02 15:35 gregkh
0 siblings, 0 replies; only message in thread
From: gregkh @ 2026-12-02 15:35 UTC (permalink / raw)
To: nicholas.spooner, cassel; +Cc: stable
The 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 <stable@vger.kernel.org>.
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 '<stable@vger.kernel.org>' --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 <nicholas.spooner@seagate.com>
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.
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>
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 87a57495d2e4..20ea1c997d56 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -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;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-12-02 16:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 15:35 FAILED: patch "[PATCH] ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE" failed to apply to 7.3-stable tree gregkh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox