Skip to content

Commit

Permalink
libata-scsi: sanitize ata_gen_ata_sense()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hannes Reinecke authored and Tejun Heo committed Apr 4, 2016
1 parent e87fd28 commit 5e6acd1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/ata/libata-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e6acd1

Please sign in to comment.