Commit a13b0c9d authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Christoph Hellwig

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: cbba5b0eReported-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarHannes Reinecke <hare@suse.de>
Reviewed-by: default avatarTejun Heo <tj@kernel.org>
Tested-by: default avatarSergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent a63bb9ba
...@@ -2481,8 +2481,6 @@ static void ata_eh_link_report(struct ata_link *link) ...@@ -2481,8 +2481,6 @@ static void ata_eh_link_report(struct ata_link *link)
for (tag = 0; tag < ATA_MAX_QUEUE; tag++) { for (tag = 0; tag < ATA_MAX_QUEUE; tag++) {
struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag); struct ata_queued_cmd *qc = __ata_qc_from_tag(ap, tag);
struct ata_taskfile *cmd = &qc->tf, *res = &qc->result_tf; 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 data_buf[20] = "";
char cdb_buf[70] = ""; char cdb_buf[70] = "";
...@@ -2510,6 +2508,9 @@ static void ata_eh_link_report(struct ata_link *link) ...@@ -2510,6 +2508,9 @@ static void ata_eh_link_report(struct ata_link *link)
} }
if (ata_is_atapi(qc->tf.protocol)) { if (ata_is_atapi(qc->tf.protocol)) {
const u8 *cdb = qc->cdb;
size_t cdb_len = qc->dev->cdb_len;
if (qc->scsicmd) { if (qc->scsicmd) {
cdb = qc->scsicmd->cmnd; cdb = qc->scsicmd->cmnd;
cdb_len = qc->scsicmd->cmd_len; cdb_len = qc->scsicmd->cmd_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment