public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mvsas: fix unaligned-access kernel panic under heavy disk testing
@ 2013-07-23 20:50 Chris Metcalf
  2013-07-23 21:00 ` James Bottomley
  0 siblings, 1 reply; 6+ messages in thread
From: Chris Metcalf @ 2013-07-23 20:50 UTC (permalink / raw)
  To: James E.J. Bottomley, Jianpeng Ma, Greg Kroah-Hartman, Xi Wang,
	Xiangliang Yu, linux-scsi, linux-kernel

The slot->response value may not be aligned, so should be read
using the appropriate kernel "unaligned" accessor.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
---
 drivers/scsi/mvsas/mv_sas.c | 5 +++--
 drivers/scsi/mvsas/mv_sas.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index f14665a..66aaa87 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1858,10 +1858,11 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
 	}
 
 	/* error info record present */
-	if (unlikely((rx_desc & RXQ_ERR) && (*(u64 *) slot->response))) {
+	if (unlikely((rx_desc & RXQ_ERR) &&
+		     get_unaligned_le64((u64 *) slot->response))) {
 		mv_dprintk("port %d slot %d rx_desc %X has error info"
 			"%016llX.\n", slot->port->sas_port.id, slot_idx,
-			 rx_desc, (u64)(*(u64 *)slot->response));
+			rx_desc, get_unaligned_le64((u64 *)slot->response));
 		tstat->stat = mvs_slot_err(mvi, task, slot_idx);
 		tstat->resp = SAS_TASK_COMPLETE;
 		goto out;
diff --git a/drivers/scsi/mvsas/mv_sas.h b/drivers/scsi/mvsas/mv_sas.h
index 60e2fb7..d6b19dc 100644
--- a/drivers/scsi/mvsas/mv_sas.h
+++ b/drivers/scsi/mvsas/mv_sas.h
@@ -39,6 +39,7 @@
 #include <linux/irq.h>
 #include <linux/slab.h>
 #include <linux/vmalloc.h>
+#include <asm/unaligned.h>
 #include <scsi/libsas.h>
 #include <scsi/scsi.h>
 #include <scsi/scsi_tcq.h>
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-07-23 22:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-23 20:50 [PATCH] mvsas: fix unaligned-access kernel panic under heavy disk testing Chris Metcalf
2013-07-23 21:00 ` James Bottomley
2013-07-23 21:17   ` Chris Metcalf
2013-07-23 22:33     ` James Bottomley
2013-07-23 22:40       ` Chris Metcalf
2013-07-23 22:55         ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox