]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.19.7/mvsas-fix-panic-on-expander-attached-sata-devices.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.19.7 / mvsas-fix-panic-on-expander-attached-sata-devices.patch
1 From 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 Mon Sep 17 00:00:00 2001
2 From: James Bottomley <JBottomley@Odin.com>
3 Date: Wed, 15 Apr 2015 22:16:01 -0700
4 Subject: mvsas: fix panic on expander attached SATA devices
5
6 From: James Bottomley <JBottomley@Odin.com>
7
8 commit 56cbd0ccc1b508de19561211d7ab9e1c77e6b384 upstream.
9
10 mvsas is giving a General protection fault when it encounters an expander
11 attached ATA device. Analysis of mvs_task_prep_ata() shows that the driver is
12 assuming all ATA devices are locally attached and obtaining the phy mask by
13 indexing the local phy table (in the HBA structure) with the phy id. Since
14 expanders have many more phys than the HBA, this is causing the index into the
15 HBA phy table to overflow and returning rubbish as the pointer.
16
17 mvs_task_prep_ssp() instead does the phy mask using the port properties.
18 Mirror this in mvs_task_prep_ata() to fix the panic.
19
20 Reported-by: Adam Talbot <ajtalbot1@gmail.com>
21 Tested-by: Adam Talbot <ajtalbot1@gmail.com>
22 Signed-off-by: James Bottomley <JBottomley@Odin.com>
23 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24
25 ---
26 drivers/scsi/mvsas/mv_sas.c | 5 +----
27 1 file changed, 1 insertion(+), 4 deletions(-)
28
29 --- a/drivers/scsi/mvsas/mv_sas.c
30 +++ b/drivers/scsi/mvsas/mv_sas.c
31 @@ -441,14 +441,11 @@ static u32 mvs_get_ncq_tag(struct sas_ta
32 static int mvs_task_prep_ata(struct mvs_info *mvi,
33 struct mvs_task_exec_info *tei)
34 {
35 - struct sas_ha_struct *sha = mvi->sas;
36 struct sas_task *task = tei->task;
37 struct domain_device *dev = task->dev;
38 struct mvs_device *mvi_dev = dev->lldd_dev;
39 struct mvs_cmd_hdr *hdr = tei->hdr;
40 struct asd_sas_port *sas_port = dev->port;
41 - struct sas_phy *sphy = dev->phy;
42 - struct asd_sas_phy *sas_phy = sha->sas_phy[sphy->number];
43 struct mvs_slot_info *slot;
44 void *buf_prd;
45 u32 tag = tei->tag, hdr_tag;
46 @@ -468,7 +465,7 @@ static int mvs_task_prep_ata(struct mvs_
47 slot->tx = mvi->tx_prod;
48 del_q = TXQ_MODE_I | tag |
49 (TXQ_CMD_STP << TXQ_CMD_SHIFT) |
50 - (MVS_PHY_ID << TXQ_PHY_SHIFT) |
51 + ((sas_port->phy_mask & TXQ_PHY_MASK) << TXQ_PHY_SHIFT) |
52 (mvi_dev->taskfileset << TXQ_SRS_SHIFT);
53 mvi->tx[mvi->tx_prod] = cpu_to_le32(del_q);
54