Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2038568imm; Mon, 16 Jul 2018 00:39:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe2iZz/W3MBdnqRqaOYtbads4llMg9FO2OdrqPlB/HIx2my514vvBevWked//5U3X/lvIb7 X-Received: by 2002:a65:6110:: with SMTP id z16-v6mr14809353pgu.412.1531726749950; Mon, 16 Jul 2018 00:39:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531726749; cv=none; d=google.com; s=arc-20160816; b=w5e2oeLXWWH+E1ixAAMaxbOilrmt5GvfUvF2JZ3Ta/KTEHpwwgrfp56P2XXsLN3VL4 UJ/KWkBPi6FwfDN+tn3tVNCK7FgZWOTQ1U/cYasg/ujrnUCR2Rygn/Bt7T+CgUaqUDAy 4eThFFV9CqflD5cSvKmbBxN28fR86fbexjDzGEXciY8c64RjnqypyrOGvnNlLSxLqXdE CsT66w4FSbEESVs1ZNM0D8EULE4uXXz6bgm+471aZqnnT9SJkm+t2z5QPhorg3BIpSLP u932WsddcajZl8ACkwj1c50WCB1wIRW/t6jQMAGh/C40Jif/Zxu+Zl50TLl4w+0CiP0c ObPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=yOcW6VTFGgStQ/iDHC3m+r9T8vyP3iRqPLesrvAjVqw=; b=0kM/BuWOP+AEJks8gtBlflBPkQGvOV1CtirKfBQeunAB4IPzFJ6aVrQzw+xSo6h/W5 nCjOrTjRa0eLrkhnEm8vgsPpI3EWVAA8ScfwJpqRz2JgCVnEZImqMMGKdxW5DpleGVbn dlE0ayWeZ6HYd4A5sCEIFpp7O0yvp8/o4o+ldjlPjfCsSqggI+pyM8VfxdAEbW5BmbVD qg2kXk50dy7qjF1V83lKDyNeEVxTXbFljVa8ZvBKjSRs4cz8PUuxUpxExuNo6VJDgqmg wIxoVz8UczALsFocB5BrHPAUuXKMHALKdbfEM5uwFR5z4Iz4BweUkIuOOsIYGFbBdliD R+Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r25-v6si28066377pge.104.2018.07.16.00.38.54; Mon, 16 Jul 2018 00:39:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731891AbeGPIDj (ORCPT + 99 others); Mon, 16 Jul 2018 04:03:39 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:46740 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728460AbeGPIDi (ORCPT ); Mon, 16 Jul 2018 04:03:38 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8472AC03; Mon, 16 Jul 2018 07:37:37 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Butterfield , Damien Le Moal , Tejun Heo Subject: [PATCH 4.17 16/67] ata: Fix ZBC_OUT all bit handling Date: Mon, 16 Jul 2018 09:34:45 +0200 Message-Id: <20180716073445.676552097@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180716073443.294323458@linuxfoundation.org> References: <20180716073443.294323458@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.17-stable review patch. If anyone has any objections, please let me know. ------------------ From: Damien Le Moal commit 6edf1d4cb0acde3a0a5dac849f33031bd7abb7b1 upstream. 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 Signed-off-by: Tejun Heo Signed-off-by: Greg Kroah-Hartman --- drivers/ata/libata-scsi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -3802,7 +3802,14 @@ static unsigned int ata_scsi_zbc_out_xla */ 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). */ @@ -3810,8 +3817,6 @@ static unsigned int ata_scsi_zbc_out_xla 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;