diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2018-06-26 07:56:55 -0400 |
---|---|---|
committer | Tejun Heo <tj@kernel.org> | 2018-07-02 11:59:26 -0400 |
commit | 6edf1d4cb0acde3a0a5dac849f33031bd7abb7b1 (patch) | |
tree | e3cb21349a195b29fe9e907ceeca3938b89b3b8a | |
parent | b320a0a9f23c98f21631eb27bcbbca91c79b1c6e (diff) |
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: David Butterfield <david.butterfield@wdc.com>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r-- | drivers/ata/libata-scsi.c | 11 |
1 files 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) | |||
3805 | */ | 3805 | */ |
3806 | goto invalid_param_len; | 3806 | goto invalid_param_len; |
3807 | } | 3807 | } |
3808 | if (block >= dev->n_sectors) { | 3808 | |
3809 | all = cdb[14] & 0x1; | ||
3810 | if (all) { | ||
3811 | /* | ||
3812 | * Ignore the block address (zone ID) as defined by ZBC. | ||
3813 | */ | ||
3814 | block = 0; | ||
3815 | } else if (block >= dev->n_sectors) { | ||
3809 | /* | 3816 | /* |
3810 | * Block must be a valid zone ID (a zone start LBA). | 3817 | * Block must be a valid zone ID (a zone start LBA). |
3811 | */ | 3818 | */ |
@@ -3813,8 +3820,6 @@ static unsigned int ata_scsi_zbc_out_xlat(struct ata_queued_cmd *qc) | |||
3813 | goto invalid_fld; | 3820 | goto invalid_fld; |
3814 | } | 3821 | } |
3815 | 3822 | ||
3816 | all = cdb[14] & 0x1; | ||
3817 | |||
3818 | if (ata_ncq_enabled(qc->dev) && | 3823 | if (ata_ncq_enabled(qc->dev) && |
3819 | ata_fpdma_zac_mgmt_out_supported(qc->dev)) { | 3824 | ata_fpdma_zac_mgmt_out_supported(qc->dev)) { |
3820 | tf->protocol = ATA_PROT_NCQ_NODATA; | 3825 | tf->protocol = ATA_PROT_NCQ_NODATA; |