From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A1A9E7C4E9 for ; Wed, 4 Oct 2023 18:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244067AbjJDSV6 (ORCPT ); Wed, 4 Oct 2023 14:21:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244066AbjJDSV4 (ORCPT ); Wed, 4 Oct 2023 14:21:56 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0722C1 for ; Wed, 4 Oct 2023 11:21:52 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3573DC433CA; Wed, 4 Oct 2023 18:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696443712; bh=R5NQXlCm2WiuMSG+SGK6bMDcAQp+sHz+6Bw2icBzyzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qFfyMaDAr1ypVWf4XsVw7OXx/nN/QWvpiqIYHToWdxTFrk1aad/xnCQbFLXH06s1G gqfKb6OHRk+ZafQnERUHXISSEkypodPQA4BpoR3DaWzS5g2fUvPrrrw8mI3xyrqIBm sEWoKOXEgOUu0VwScpYXZaahXcXUnreqizlXsQtg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Niklas Cassel , Damien Le Moal Subject: [PATCH 6.1 225/259] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES Date: Wed, 4 Oct 2023 19:56:38 +0200 Message-ID: <20231004175227.660311208@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20231004175217.404851126@linuxfoundation.org> References: <20231004175217.404851126@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Niklas Cassel commit 3ef600923521616ebe192c893468ad0424de2afb upstream. For REPORT SUPPORTED OPERATION CODES command, the service action field is defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second byte are reserved. Only look at the service action field in the second byte when determining if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command. This matches how we only look at the service action field in the second byte when determining if the SERVICE ACTION IN(16) opcode is a READ CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored). Fixes: 7b2030942859 ("libata: Add support for SCT Write Same") Cc: stable@vger.kernel.org Signed-off-by: Niklas Cassel Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libata-scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -4227,7 +4227,7 @@ void ata_scsi_simulate(struct ata_device break; case MAINTENANCE_IN: - if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES) + if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES) ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in); else ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);