summaryrefslogtreecommitdiff
path: root/drivers/ata/libata-scsi.c
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2016-04-04 11:43:56 +0200
committerTejun Heo <tj@kernel.org>2016-04-04 12:07:40 -0400
commit5e6acd1c8c4dc9a7c16208aeac3de09151ee6233 (patch)
tree8152bc8108fa4f7c7652a1e2b8bbbc6f44c5b327 /drivers/ata/libata-scsi.c
parente87fd28cf9a2d9018ac4b6dd92f0b417714bc18d (diff)
libata-scsi: sanitize ata_gen_ata_sense()
ata_to_sense_error() is called conditionally, so we should be generating a default sense if the condition is not met. Signed-off-by: Hannes Reinecke <hare@suse.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'drivers/ata/libata-scsi.c')
-rw-r--r--drivers/ata/libata-scsi.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 6dc2fadfd7c5..e331077ee446 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -1074,6 +1074,12 @@ static void ata_gen_ata_sense(struct ata_queued_cmd *qc)
ata_to_sense_error(qc->ap->print_id, tf->command, tf->feature,
&sb[1], &sb[2], &sb[3], verbose);
sb[1] &= 0x0f;
+ } else {
+ /* Could not decode error */
+ ata_dev_warn(dev, "could not decode error status 0x%x err_mask 0x%x\n",
+ tf->command, qc->err_mask);
+ ata_scsi_set_sense(cmd, ABORTED_COMMAND, 0, 0);
+ return;
}
block = ata_tf_read_block(&qc->result_tf, dev);