From patchwork Tue Jun 26 07:18:38 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: 10488101 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 8D3EE602D8 for ; Tue, 26 Jun 2018 07:18:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7807E271FD for ; Tue, 26 Jun 2018 07:18:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6C99727B13; Tue, 26 Jun 2018 07:18:48 +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 19198271FD for ; Tue, 26 Jun 2018 07:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752614AbeFZHSp (ORCPT ); Tue, 26 Jun 2018 03:18:45 -0400 Received: from esa5.hgst.iphmx.com ([216.71.153.144]:30387 "EHLO esa5.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752472AbeFZHSn (ORCPT ); Tue, 26 Jun 2018 03:18:43 -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=1529997524; x=1561533524; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=A4mZ1DvxIipzeD/zsNz83kNiTYKHwymmnDi5TEuG7co=; b=qjJi40FIvs9Mrb3M6Y4Xeik/jMDL/PtgL4utSLDmQGnozk09z3uzhJ+W t+GK57fBPEW1ZIvYMfZ6AgP3w6Lk9Zn3L2XQEK/vsyl/yLb8uzqZuqgCf Zd72d+GT7w2ovr/dOtOxQunD/izDO5qheAO38dAl3AximLkAYPEf9FU7W yNhQ/kPMFGzXeQhYB2v3iah9Vlqqk10sOhSDWvH2o+QvDxI7wHbU9WqmQ wLUPwG5RcQ6up0iL1otqpE9I6y9SDrerpu6uJ+kj13dE1rczO4/4k3uXO 73zcsWQ3oeuw3gHYiX6i9/ddS5R6XfFyEa8JiufNJr7VwL3Gac506KYMn A==; X-IronPort-AV: E=Sophos;i="5.51,273,1526313600"; d="scan'208";a="82452414" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 26 Jun 2018 15:18:44 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 26 Jun 2018 00:08:03 -0700 Received: from washi.fujisawa.hgst.com ([10.149.53.254]) by uls-op-cesaip02.wdc.com with ESMTP; 26 Jun 2018 00:18:41 -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 2/2] ata: Fix ZBC_OUT all bit handling Date: Tue, 26 Jun 2018 16:18:38 +0900 Message-Id: <20180626071838.15140-3-damien.lemoal@wdc.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626071838.15140-1-damien.lemoal@wdc.com> References: <20180626071838.15140-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 --- 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;