Skip to content

Commit 8de309e

Browse files
Arun Easimartinkpetersen
Arun Easi
authored andcommitted
scsi: qla2xxx: Fix crash during driver load on big endian machines
Crash stack: [576544.715489] Unable to handle kernel paging request for data at address 0xd00000000f970000 [576544.715497] Faulting instruction address: 0xd00000000f880f64 [576544.715503] Oops: Kernel access of bad area, sig: 11 [#1] [576544.715506] SMP NR_CPUS=2048 NUMA pSeries : [576544.715703] NIP [d00000000f880f64] .qla27xx_fwdt_template_valid+0x94/0x100 [qla2xxx] [576544.715722] LR [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx] [576544.715726] Call Trace: [576544.715731] [c0000004d0ffb000] [c0000006fe02c350] 0xc0000006fe02c350 (unreliable) [576544.715750] [c0000004d0ffb080] [d00000000f7952dc] .qla24xx_load_risc_flash+0x2fc/0x590 [qla2xxx] [576544.715770] [c0000004d0ffb170] [d00000000f7aa034] .qla81xx_load_risc+0x84/0x1a0 [qla2xxx] [576544.715789] [c0000004d0ffb210] [d00000000f79f7c8] .qla2x00_setup_chip+0xc8/0x910 [qla2xxx] [576544.715808] [c0000004d0ffb300] [d00000000f7a631c] .qla2x00_initialize_adapter+0x4dc/0xb00 [qla2xxx] [576544.715826] [c0000004d0ffb3e0] [d00000000f78ce28] .qla2x00_probe_one+0xf08/0x2200 [qla2xxx] Link: https://lore.kernel.org/r/[email protected] Fixes: f73cb69 ("[SCSI] qla2xxx: Add support for ISP2071.") Cc: [email protected] Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Arun Easi <[email protected]> Signed-off-by: Nilesh Javali <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent aceba54 commit 8de309e

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

drivers/scsi/qla2xxx/qla_tmpl.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ qla27xx_template_checksum(void *p, ulong size)
928928
static inline int
929929
qla27xx_verify_template_checksum(struct qla27xx_fwdt_template *tmp)
930930
{
931-
return qla27xx_template_checksum(tmp, tmp->template_size) == 0;
931+
return qla27xx_template_checksum(tmp,
932+
le32_to_cpu(tmp->template_size)) == 0;
932933
}
933934

934935
static inline int
@@ -944,7 +945,7 @@ qla27xx_execute_fwdt_template(struct scsi_qla_host *vha,
944945
ulong len = 0;
945946

946947
if (qla27xx_fwdt_template_valid(tmp)) {
947-
len = tmp->template_size;
948+
len = le32_to_cpu(tmp->template_size);
948949
tmp = memcpy(buf, tmp, len);
949950
ql27xx_edit_template(vha, tmp);
950951
qla27xx_walk_template(vha, tmp, buf, &len);
@@ -960,7 +961,7 @@ qla27xx_fwdt_calculate_dump_size(struct scsi_qla_host *vha, void *p)
960961
ulong len = 0;
961962

962963
if (qla27xx_fwdt_template_valid(tmp)) {
963-
len = tmp->template_size;
964+
len = le32_to_cpu(tmp->template_size);
964965
qla27xx_walk_template(vha, tmp, NULL, &len);
965966
}
966967

@@ -972,7 +973,7 @@ qla27xx_fwdt_template_size(void *p)
972973
{
973974
struct qla27xx_fwdt_template *tmp = p;
974975

975-
return tmp->template_size;
976+
return le32_to_cpu(tmp->template_size);
976977
}
977978

978979
int

drivers/scsi/qla2xxx/qla_tmpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
struct __packed qla27xx_fwdt_template {
1313
__le32 template_type;
1414
__le32 entry_offset;
15-
uint32_t template_size;
15+
__le32 template_size;
1616
uint32_t count; /* borrow field for running/residual count */
1717

1818
__le32 entry_count;

0 commit comments

Comments
 (0)