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=1796384585; b=AzE5B0hJPlyTy0oRQABma0ie+SW+vGbr1qTlIG33FlgiUPIwL39ojJFtW9aLm+mc6QTu St9rpF4v3VytQuVkFQ4k7I+DD9nCgAjfpZsd1MLzJzOl5h2Axe3BiiULFKR+mT4H+tbxF 6XbqNYZRmQG8HzDJDcm6cgNeu+Th+xzkjw7P9OQnAyrZDXK7N+TWHi79w2fxOJK3WNqt7 /XL5wy7woof2PTxw5ua4kJXleyFZqwmxQ73EAAa/S+e4tSJCA1a/C+xPy4ookud8BxZ2B lIQiOLiTPF8XQi+eomhFzIfcfxpV5VLQJmP9XXSnhHEtebu9pBwJnl2xEw5lyYj1H4A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796384585; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=wc+kXJwBvxBvTn0iT81GJuhIk7BS/E5wawTfF5hylOA=; b=IC5qDADogFZruNkswlrb3pyRfwXZQz8lh2XYZFTlaODfH2tUcR2HMlBKZeYJo4fqU2JH qeJC9TKIabx+q6STkEZmrhYVagnETMPIzaqaGuhulSxpmFvyq+nc1BYDwLpREZ2sD/yVZ 6yILO3rtlZivSzaVZbWp15y8QLwyN7NpYYzn9AqLK5heRSKH0G0/OE2Vwx9oX4A+nQy3g /54ytOdrWOmDQhnxvBP4ocx+PpA0iOoF4HwIzl1pfhEozWSbvij/lu9PQ8/sf4XFVTeUj 2FgkZ8OgkYrbqb0htTwq1uXFs55o2/s/8Ar+X7gyRi/vBnXwLl/NWc6RXTlzwm/C8BQ== 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=EmInIiJM; 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 56D91606A689; Fri, 4 Dec 2026 11:43:05 +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=EmInIiJM Received: by smtp.kernel.org (Postfix) with ESMTPSA id 761B51F00897; Fri, 4 Dec 2026 11:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796384584; bh=wc+kXJwBvxBvTn0iT81GJuhIk7BS/E5wawTfF5hylOA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EmInIiJMx2+TPPbVFgLsHg4CWz6PfxVraXa4Uy1wEodTQolJ+pJSj02Cj6ULs8ecZ krxlT7W2ObNawy6SSU64o2RO9bLfdEOWYI5ePJKPX2mAtcHnDXPu2L2VcXqzxJrcQY vTI33nFDByipLqe+oNRakZglGENN4v+/CI2zJdAU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Shao Mingyin , Damien Le Moal , Niklas Cassel , Sasha Levin Subject: [PATCH 6.6 0212/1167] ata: libata-scsi: set the field pointer when rejecting CDL Date: Fri, 4 Dec 2026 18:53:59 +0900 Message-ID: <20261204100707.590078661@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Shao Mingyin [ Upstream commit 7c972e73641cbe5f77f63c336de15c7a30268d49 ] ata_mselect_control_ata_feature() rejects enabling CDL while NCQ priority is enabled, but unlike its other error branches it returns without setting *fp. ata_scsi_mode_select_xlat() initializes fp to 0xffff and, when the handler fails, adds the offset of the mode page in the parameter list to it, i.e. the length of the mode parameter header and of the block descriptors. As fp is a u16, this wraps around, so the resulting sense data reports the byte before the mode page, i.e. the last byte of the mode parameter header or of the block descriptors, as the FIELD POINTER, instead of the byte containing the CDL_CTRL field that requests enabling CDL. Set *fp to 4, i.e. to the byte containing the CDL_CTRL field, like the branch rejecting an invalid CDL_CTRL value does. Fixes: df60f9c64576 ("scsi: ata: libata: Add ATA feature control sub-page translation") Signed-off-by: Shao Mingyin [cassel: set *fp to 4, the offset of CDL_CTRL in the mode page] Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20261103205448.931471-17-cassel@kernel.org Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin --- drivers/ata/libata-scsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 74a3c7aedca91..b56f71948f701 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3887,6 +3887,7 @@ static int ata_mselect_control_ata_feature(struct ata_queued_cmd *qc, if (dev->flags & ATA_DFLAG_NCQ_PRIO_ENABLED) { ata_dev_err(dev, "NCQ priority must be disabled to enable CDL\n"); + *fp = 4; return -EINVAL; } ata_dev_dbg(dev, "Enabling CDL\n"); -- 2.53.0