summaryrefslogtreecommitdiff
path: root/drivers/ata
diff options
context:
space:
mode:
authorHannes Reinecke <hare@suse.de>2015-01-19 16:55:38 +0100
committerChristoph Hellwig <hch@lst.de>2015-01-20 19:41:41 +0100
commita13b0c9d09157e331b31e25c1ea19216b837a619 (patch)
tree3fa30eff3ed1e4e502d2b81b83438c456cf38a8e /drivers/ata
parenta63bb9ba84c4b32569a6ac6040c2a919b4ff4a14 (diff)
libata: fixup oops in ata_eh_link_report()
We should only try to evaluate the cdb if this is an ATAPI device, for any other device the 'cdb' field and the cdb_len has no meaning. Fixes: cbba5b0ee4c6c2fc8b78a21d0900099d480cf2e9 Reported-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Tejun Heo <tj@kernel.org> Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/ata')
-rw-r--r--drivers/ata/libata-eh.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
index 9179f1123213..665fd2b18970 100644
--- a/drivers/ata/libata-eh.c
+++ b/drivers/ata/libata-eh.c
@@ -2481,8 +2481,6 @@ static void ata_eh_link_report(struct ata_link *link)
for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf;
- const u8 *cdb = qc->cdb;
- size_t cdb_len = qc->dev->cdb_len;
char data_buf[20] = "";
char cdb_buf[70] = "";
@@ -2510,6 +2508,9 @@ static void ata_eh_link_report(struct ata_link *link)
}
if (ata_is_atapi(qc->tf.protocol)) {
+ const u8 *cdb = qc->cdb;
+ size_t cdb_len = qc->dev->cdb_len;
+
if (qc->scsicmd) {
cdb = qc->scsicmd->cmnd;
cdb_len = qc->scsicmd->cmd_len;