From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796228161; b=oLTWjyMi3qr7l6YI+05Vb3hc6a8ogLOw2xVYo1G1HLAhFpZyts9JhdVSRVV1S1bhgVMd emCGNKaSDxn7zkIqjHG90CoOM8CCyUo9lGs3IM+5YkxVGVGKnxapNQVWyaX3GBEw1jrgN LMos9A3tCBY8Sbl3TSZD9ukCkj55ppKBuhSPV8xqqoF4f3Fdi/IA0GR3uPfv4vAYc8x8D mPz6MCecF7GAZ6p3pkJXaWVkB5vPCdPO/sMt+BCCygHKCsR5vljcvnTyp0JRehcSO72hH G4Sc/3GX2Gbua8JFN3t5fAsmV1eKfarlo0iGxkwv6IUzczx73Ur+6Jlr8dE/QxGrJ2g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796228161; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=ffvAPBfS7ETkTxTeN7pWRn3a4VrFH6obRobvjysSXuo=; b=Wp+9gtiyM5nqGAYUkJv417d+ohK5jb1lDBWP7Ue54OsW+DsF4tSbggLARdbt2jxqGC99 htl2hrLJ8lYEultVZIHIj5ME6m4PQiUHQfDyNaIzrFRQcWnDQki2PMgTqpyMwRjoby/cd HmZLKkk+1ZaQJWozsO6UfYOHqwr50/HZxI+p9GOtfcgnvel/REHN3QtWYIzz8X75ZEFAc Y4K2euEtcwjmHnJU2kvhYM81NlaFt5EI4QH0MjyKHTN/HVz5bldIBgFQ8oL/BjoPvUpKc Bx6bwdr+0As8uBXxnFzF/dHdMAnrFd9RapWVHSrS7vfcnnkpJ+qwmfBFdXhquZkUwHg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dhoVcz2f; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36F8B606A332 for ; Wed, 2 Dec 2026 16:16:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dhoVcz2f Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14BBB1F008A0; Wed, 2 Dec 2026 16:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796228160; bh=ffvAPBfS7ETkTxTeN7pWRn3a4VrFH6obRobvjysSXuo=; h=Subject:To:Cc:From:Date; b=dhoVcz2fDxMGuCbXf0TMcrH72PPKDg+oyFEIE+DkATQQC2jwsrsmT5ySPVHRH1I5d 9uZVzYhy++EFwbQt8ghzKaveBGH2zQNl1I1KEvidjsjZU0veltuHtq5prm6R1vsDKX PufzT1f74fzDunxXzl+FhCXgZcUl8+XDa2z1imMc= Subject: FAILED: patch "[PATCH] ata: libata-scsi: fix REQUESTED MAX LBA field for REMOVE" failed to apply to 7.3-stable tree To: nicholas.spooner@seagate.com,cassel@kernel.org Cc: From: Date: Wed, 02 Dec 2026 16:35:44 +0100 Message-ID: <2026120244-gooey-bunkmate-07d7@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit 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 . 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 # git commit -s git send-email --to '' --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 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 Link: https://lore.kernel.org/r/20261113151929.9586-1-nicholas.spooner@seagate.com Signed-off-by: Niklas Cassel 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;