Skip to contentSkip to conversation

libata: fixup oops in ata_eh_link_report()

PATCH Superseded Hannes Reinecke 3 participants 5 messages Jan 19, 2015 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 drivers/ata/libata-eh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +3 -2
index 9179f11..584c6ae 100644
@@ -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 = qd->dev->cdb_len;
+
 			if (qc->scsicmd) {
 				cdb = qc->scsicmd->cmnd;
 				cdb_len = qc->scsicmd->cmd_len;
Signature · 1 line
1.8.5.2
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Hannes Reinecke

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.

But, can you please refer to the commit which broke it and what the result of the breakage was? I suppose this should go through the same tree that the offending commit went through, right?

Thanks.

Signature · 1 line
tejun
#2 lore raw
In reply to Hannes Reinecke
Quoted 31 lines · Hannes Reinecke

Date: Mon, 19 Jan 2015 13:00:59 +0100
From: Hannes Reinecke <[email protected]>
To: Tejun Heo <[email protected]>
Cc: [email protected], [email protected], Sergey
Senozhatsky <[email protected]>, Hannes Reinecke <[email protected]>
Subject: [PATCH] libata: fixup oops in ata_eh_link_report()
X-Mailer: git-send-email 1.8.5.2

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.

---
 drivers/ata/libata-eh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +0 -2
index 9179f11..584c6ae 100644
@@ -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] = "";
 

drivers/ata/libata-eh.c static void ata_eh_link_report(struct ata_link *link) · line 2512

Quoted 5 lines
drivers/ata/libata-eh.c +2 -0
@@ -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 = qd->dev->cdb_len;

I think, it supposed to be qc, not qd.

	-ss
Quoted 6 lines
drivers/ata/libata-eh.c +0 -0
 			if (qc->scsicmd) {
 				cdb = qc->scsicmd->cmnd;
 				cdb_len = qc->scsicmd->cmd_len;
Signature · 1 line
1.8.5.2
#3 lore raw
Quoted 31 lines · Sergey Senozhatsky
Quoted 30 lines · Hannes Reinecke

Date: Mon, 19 Jan 2015 13:00:59 +0100
From: Hannes Reinecke <[email protected]>
To: Tejun Heo <[email protected]>
Cc: [email protected], [email protected], Sergey
Senozhatsky <[email protected]>, Hannes Reinecke <[email protected]>
Subject: [PATCH] libata: fixup oops in ata_eh_link_report()
X-Mailer: git-send-email 1.8.5.2

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.

---
 drivers/ata/libata-eh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +0 -2
index 9179f11..584c6ae 100644
@@ -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] = "";
 
Quoted 9 lines

drivers/ata/libata-eh.c static void ata_eh_link_report(struct ata_link *link) · line 2512

Quoted 6 lines
drivers/ata/libata-eh.c +2 -0
@@ -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 = qd->dev->cdb_len;

I think, it supposed to be qc, not qd.

Bzzt.

Of course.

I'll be redoing the patch, and will be adding the original commit id as indicated by Tejun.

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)
#4 lore raw
Quoted 31 lines · Hannes Reinecke
Quoted 22 lines
Quoted 22 lines

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.

---
 drivers/ata/libata-eh.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/ata/libata-eh.c +0 -2
index 9179f11..584c6ae 100644
@@ -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] = "";
 
Quoted 9 lines

drivers/ata/libata-eh.c static void ata_eh_link_report(struct ata_link *link) · line 2512

Quoted 6 lines
drivers/ata/libata-eh.c +2 -0
@@ -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 = qd->dev->cdb_len;

I think, it supposed to be qc, not qd.

Quoted 6 lines

Bzzt.

Of course.

I'll be redoing the patch, and will be adding the original commit id as indicated by Tejun.

	-ss
Quoted 10 lines

Cheers,

Hannes

Signature · 5 lines
Dr. Hannes Reinecke		               zSeries & Storage
[email protected]			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)