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=1796387234; b=wtWD+ZK0UxLS5CTb+BcxC3PDra+8QsT8RrBtnt2Lo54JRfjgX7wcO6Nu96KW7iBiiilz YXGmTgfjL1W0FahBDZBVZNFyK+q1QTJLWShhSBWiCnulDxkB8Nw3Bvm6sIJDsP3pTULYk Plaw09pXchCsR7eL3cpjir/OFjHnkIqUJA6UXbGHjxs4hrNDDI2l60yuqxwc9JdGHYUTu W2Jyq31aisTPIN3v1CinDl4dCuOT7HFG46ZUJwNbwGFIarrtpQQYx2/rJfNUe1VM3LSPs ukXfqkjFtTz9JAx7VLW7nFMz0anPvTCUz09GP0cGTD2VaMJ79obrw5hid1lrALk4QHg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387234; 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=XvyoGrdzofPr9OCbKBBOFfcuQcvsOFSIc+QGfjEWxWk=; b=WOcDDfsEeY0hFZBmoqEdWVbZBrqLk1mU6ECMSstaELTFq8cEyHbj+sKGpEy55PIVBqNc rBTknQ5nPIK16OQvC0dtg91a2hFLbE8gmHKWuWi0AD2kHmtcyHNbD9+Sf0m+BTAh5SCHO d1wAa4bJEZJlMMwYkMh1nbV5uyXw2oAZMzy04v+RZ8Kbe/J8nfjYeIephTb1TjPqP68Id im6S/jsjEpqOegTu5qAfe+gM1T5jHWcy+TvMH/Y02VZMdJzvXGeBJbq5SWSNbbdrQZjSN xezaqC72MpUpQ4eVzlKn2C7jwqgQItXAQm7BQvzPMMCkNtGTDoFvsjSPH8OC65sJACA== 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=FlfBQW2l; 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 294F4606A322; Fri, 4 Dec 2026 12:27:14 +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=FlfBQW2l Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7BC6C1F0092C; Fri, 4 Dec 2026 12:27:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387233; bh=XvyoGrdzofPr9OCbKBBOFfcuQcvsOFSIc+QGfjEWxWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FlfBQW2lCCfUxKGOaZxLsdc3QaVD9W43fbVXfjcasNfgvX0C2OwlKFzcDK68OyRO3 pEKK/Tzq7i75mvFBIEcFJwaD8E+I881vKjORCojObbeed/QoAvSS5w6nt4kmM6bNP2 3qOZbJ0v3wgrLzCaApgHJABcN2nqo0x1EnsuPCv0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Damien Le Moal , Niklas Cassel , Sasha Levin Subject: [PATCH 6.1 0160/1059] ata: libata-scsi: fix MODE SELECT field pointer for block descriptor length Date: Fri, 4 Dec 2026 18:54:51 +0900 Message-ID: <20261204100648.370674632@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore 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-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Niklas Cassel [ Upstream commit a3e52dcf0fbaa1a103accef3e8861cdc250ee5d6 ] ata_scsi_mode_select_xlat() only accepts MODE SELECT parameter lists without block descriptors or with a single 8 byte block descriptor. For any other BLOCK DESCRIPTOR LENGTH, it terminates the command with INVALID FIELD IN PARAMETER LIST, and the FIELD POINTER should point at the BLOCK DESCRIPTOR LENGTH field, i.e. at byte 3 of the mode parameter header(6) or at byte 6 of the mode parameter header(10), as SPC requires the FIELD POINTER of a multiple-byte field to point at its first byte. However, the mode parameter header length and the BLOCK DESCRIPTOR LENGTH are added to the offset of the field, so the FIELD POINTER points 3 or 6 bytes after the end of the block descriptors instead. For example, a MODE SELECT(10) with a BLOCK DESCRIPTOR LENGTH of 16 reports byte 30 instead of byte 6. Do not add the mode parameter header length and the BLOCK DESCRIPTOR LENGTH to the offset of the BLOCK DESCRIPTOR LENGTH field. Fixes: 7780081c1f04 ("libata-scsi: Set information sense field for invalid parameter") Reviewed-by: Damien Le Moal Link: https://lore.kernel.org/r/20261103205448.931471-15-cassel@kernel.org Signed-off-by: Niklas Cassel Signed-off-by: Sasha Levin --- drivers/ata/libata-scsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 167bc569859ca..e905d39930e52 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3905,7 +3905,6 @@ static unsigned int ata_scsi_mode_select_xlat(struct ata_queued_cmd *qc) goto invalid_param_len; if (bd_len != 0 && bd_len != 8) { fp = (six_byte) ? 3 : 6; - fp += bd_len + hdr_len; goto invalid_param; } -- 2.53.0