From: <gregkh@linuxfoundation.org>
To: nicholas.spooner@seagate.com,cassel@kernel.org
Cc: <stable@vger.kernel.org>
Subject: FAILED: patch "[PATCH] ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE" failed to apply to 7.3-stable tree
Date: Wed, 02 Dec 2026 16:35:44 +0100 [thread overview]
Message-ID: <2026120244-gooey-bunkmate-07d7@gregkh> (raw)
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;
reply other threads:[~2026-12-02 16:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2026120244-gooey-bunkmate-07d7@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=cassel@kernel.org \
--cc=nicholas.spooner@seagate.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox