From patchwork Tue Jun 26 11:56:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Damien Le Moal X-Patchwork-Id: 10488785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BE15A602D8 for ; Tue, 26 Jun 2018 11:57:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5AAA2857F for ; Tue, 26 Jun 2018 11:57:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9D41286C0; Tue, 26 Jun 2018 11:57:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 50B782857F for ; Tue, 26 Jun 2018 11:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934771AbeFZL5E (ORCPT ); Tue, 26 Jun 2018 07:57:04 -0400 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:33875 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934556AbeFZL5C (ORCPT ); Tue, 26 Jun 2018 07:57:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1530014222; x=1561550222; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=PHTBL6zY+8a8dji3NcdnB/imjbdJjZxExlJG+yYuRN8=; b=JKAteCcY8mAKnfgDjm0vspnAbinN+ZJTRJkjke3qiI5SpTlsZZPlDf/1 qJnj5GicbY2ngcGNNkXzlUrsOuMbNMty4uF35jtUn7OIEJMPlXc4DYlcl SJrU6Q/AFef/o+Th2iol0S0zMf9cd4lXFsphp1JJRKCk6VrZFZXKf0CGv c+Xeim/jHFI1cEsT7YIuGDW9sKpKT6JeaM0Q5zBQzWuqACPWPehwIQgK1 FlzOJID9Lo0S87rOwiHtqthq7L0h6XVeE9zEcpQg7Jqo5v9A83n8ZThZ5 B2bvhh870U3GSYBIQ09VPJc9aMF4UR8KczikVnyNKRBuDIinkIUW55/td g==; X-IronPort-AV: E=Sophos;i="5.51,274,1526313600"; d="scan'208";a="185381043" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2018 19:57:02 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP; 26 Jun 2018 04:46:37 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip01.wdc.com with ESMTP; 26 Jun 2018 04:57:02 -0700 From: Damien Le Moal To: Tejun Heo , linux-ide@vger.kernel.org Cc: linux-scsi@vger.kernel.org, "Martin K . Petersen" , Bart Van Assche , Hannes Reinecke , stable@vger.kernel.org Subject: [PATCH V2 2/2] ata: Fix ZBC_OUT all bit handling Date: Tue, 26 Jun 2018 20:56:55 +0900 Message-Id: <20180626115655.15562-3-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626115655.15562-1-damien.lemoal@wdc.com> References: <20180626115655.15562-1-damien.lemoal@wdc.com> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP If the ALL bit is set in the ZBC_OUT command, the command zone ID field (block) should be ignored. Reported-by: David Butterfield Signed-off-by: Damien Le Moal Cc: stable@vger.kernel.org --- drivers/ata/libata-scsi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index a5543751f446..aad1b01447de 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3805,7 +3805,14 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc) */ goto invalid_param_len; } - if (block >= dev->n_sectors) { + + all = cdb[14] & 0x1; + if (all) { + /* + * Ignore the block address (zone ID) as defined by ZBC. + */ + block = 0; + } else if (block >= dev->n_sectors) { /* * Block must be a valid zone ID (a zone start LBA). */ @@ -3813,8 +3820,6 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc) goto invalid_fld; } - all = cdb[14] & 0x1; - if (ata_ncq_enabled(qc->dev) && ata_fpdma_zac_mgmt_out_supported(qc->dev)) { tf->protocol = ATA_PROT_NCQ_NODATA;