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: 934832 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-ide-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="JKAteCcY"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41FPfV3Y74z9s1R for ; Tue, 26 Jun 2018 21:57:06 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934769AbeFZL5E (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-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org 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;