aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Odin.com>2015-04-16 01:16:01 -0400
committerJames Bottomley <JBottomley@Odin.com>2015-04-17 13:19:07 -0400
commit56cbd0ccc1b508de19561211d7ab9e1c77e6b384 (patch)
tree7555bf5a8f8fa03e0630aeab5ef6ebd1af96595e
parent8041708ed4d993c5466c20926210598afa97194e (diff)
mvsas: fix panic on expander attached SATA devices
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>
-rw-r--r--drivers/scsi/mvsas/mv_sas.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index 2d5ab6d969ec..454536c49315 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_task *task, u32 *tag)
441static int mvs_task_prep_ata(struct mvs_info *mvi, 441static int mvs_task_prep_ata(struct mvs_info *mvi,
442 struct mvs_task_exec_info *tei) 442 struct mvs_task_exec_info *tei)
443{ 443{
444 struct sas_ha_struct *sha = mvi->sas;
445 struct sas_task *task = tei->task; 444 struct sas_task *task = tei->task;
446 struct domain_device *dev = task->dev; 445 struct domain_device *dev = task->dev;
447 struct mvs_device *mvi_dev = dev->lldd_dev; 446 struct mvs_device *mvi_dev = dev->lldd_dev;
448 struct mvs_cmd_hdr *hdr = tei->hdr; 447 struct mvs_cmd_hdr *hdr = tei->hdr;
449 struct asd_sas_port *sas_port = dev->port; 448 struct asd_sas_port *sas_port = dev->port;
450 struct sas_phy *sphy = dev->phy;
451 struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number];
452 struct mvs_slot_info *slot; 449 struct mvs_slot_info *slot;
453 void *buf_prd; 450 void *buf_prd;
454 u32 tag = tei->tag, hdr_tag; 451 u32 tag = tei->tag, hdr_tag;
@@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_info *mvi,
468 slot->tx = mvi->tx_prod; 465 slot->tx = mvi->tx_prod;
469 del_q = TXQ_MODE_I | tag | 466 del_q = TXQ_MODE_I | tag |
470 (TXQ_CMD_STP << TXQ_CMD_SHIFT) | 467 (TXQ_CMD_STP << TXQ_CMD_SHIFT) |
471 (MVS_PHY_ID << TXQ_PHY_SHIFT) | 468 ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) |
472 (mvi_dev->taskfileset << TXQ_SRS_SHIFT); 469 (mvi_dev->taskfileset << TXQ_SRS_SHIFT);
473 mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q); 470 mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
474 471