mvsas: fix panic on expander attached SATA devices
authorJames Bottomley <JBottomley@Odin.com>
Thu, 16 Apr 2015 05:16:01 +0000 (22:16 -0700)
committerSasha Levin <sasha.levin@oracle.com>
Sun, 17 May 2015 23:12:20 +0000 (19:12 -0400)
commit3b2b5bee96e5e2b0948cffd033f327ed69508ba3
tree46a69f3be6aa8b423d963213e1fa2dceb96c33a8
parent49afcd312b7f73495764fc16a8b9f25e9e6a14ae
mvsas: fix panic on expander attached SATA devices

[ Upstream commit 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 ]

mvsas is giving a General protection fault when it encounters an expander
attached ATA device.  Analysis of mvs_task_prep_ata() shows that the driver is
assuming all ATA devices are locally attached and obtaining the phy mask by
indexing the local phy table (in the HBA structure) with the phy id.  Since
expanders have many more phys than the HBA, this is causing the index into the
HBA phy table to overflow and returning rubbish as the pointer.

mvs_task_prep_ssp() instead does the phy mask using the port properties.
Mirror this in mvs_task_prep_ata() to fix the panic.

Reported-by: Adam Talbot <ajtalbot1@gmail.com>
Tested-by: Adam Talbot <ajtalbot1@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: James Bottomley <JBottomley@Odin.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
drivers/scsi/mvsas/mv_sas.c