Commit 6edf1d4c authored by Damien Le Moal's avatar Damien Le Moal Committed by Tejun Heo
Browse files

ata: Fix ZBC_OUT all bit handling



If the ALL bit is set in the ZBC_OUT command, the command zone ID field
(block) should be ignored.

Reported-by: default avatarDavid Butterfield <david.butterfield@wdc.com>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: default avatarTejun Heo <tj@kernel.org>
parent b320a0a9
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -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;