From: Greg Kroah-Hartman Date: Mon, 9 Jun 2014 23:55:00 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.14.7~7 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c96ffd492b20cee045410ead50aefeb1535f1014;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: fix-4-port-and-add-support-for-8-port-unknown-pci-serial-port-cards.patch hpsa-gen8plus-smart-array-ids.patch isci-fix-a-race-condition-in-the-ssp-task-management-path.patch iscsi-target-always-send-a-response-before-terminating-iscsi-connection.patch mpt2sas-fix-for-device-scan-following-host-reset-could-get.patch mpt2sas-fix-for-issue-missing-delay-not-getting-set-during-system-bootup.patch serial-pch_uart-fix-tty-kref-leak-in-dma-rx-path.patch serial-pch_uart-fix-tty-kref-leak-in-rx-error-path.patch target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch target-fix-maintenance_in-service-action-cdb-checks-to-use-lower-5-bits.patch target-pscsi-fix-return-value-check.patch target-use-correct-sense-code-for-lun-communication-failure.patch tty-correct-tty-buffer-flush.patch --- diff --git a/queue-3.4/fix-4-port-and-add-support-for-8-port-unknown-pci-serial-port-cards.patch b/queue-3.4/fix-4-port-and-add-support-for-8-port-unknown-pci-serial-port-cards.patch new file mode 100644 index 00000000000..1b06134f392 --- /dev/null +++ b/queue-3.4/fix-4-port-and-add-support-for-8-port-unknown-pci-serial-port-cards.patch @@ -0,0 +1,95 @@ +From d13402a4a944e72612a9ec5c9190e35717c02a9d Mon Sep 17 00:00:00 2001 +From: Scott Ashcroft +Date: Sun, 3 Mar 2013 21:35:06 +0000 +Subject: Fix 4 port and add support for 8 port 'Unknown' PCI serial port cards + +From: Scott Ashcroft + +commit d13402a4a944e72612a9ec5c9190e35717c02a9d upstream. + +I've managed to find an 8 port version of the card 4 port card which was discussed here: + +http://marc.info/?l=linux-serial&m=120760744205314&w=2 + +Looking back at that thread there were two issues in the original patch. + +1) The I/O ports for the UARTs are within BAR2 not BAR0. This can been seen in the original post. +2) A serial quirk isn't needed as these cards have no memory in BAR0 which makes pci_plx9050_init just return. + +This patch fixes the 4 port support to use BAR2, removes the bogus quirk and adds support for the 8 port card. + +$ lspci -vvv -n -s 00:08.0 +00:08.0 0780: 10b5:9050 (rev 01) + Subsystem: 10b5:1588 + Control: I/O+ Mem- BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx- + Status: Cap+ 66MHz- UDF- FastB2B+ ParErr- DEVSEL=medium >TAbort- SERR- + Kernel driver in use: serial + +$ dmesg | grep 0000:00:08.0: +[ 0.083320] pci 0000:00:08.0: [10b5:9050] type 0 class 0x000780 +[ 0.083355] pci 0000:00:08.0: reg 14: [io 0xff00-0xff7f] +[ 0.083369] pci 0000:00:08.0: reg 18: [io 0xfe00-0xfe3f] +[ 0.083382] pci 0000:00:08.0: reg 1c: [io 0xfd00-0xfd07] +[ 0.083460] pci 0000:00:08.0: PME# supported from D0 D3hot +[ 1.212867] 0000:00:08.0: ttyS4 at I/O 0xfe00 (irq = 17) is a 16550A +[ 1.233073] 0000:00:08.0: ttyS5 at I/O 0xfe08 (irq = 17) is a 16550A +[ 1.253270] 0000:00:08.0: ttyS6 at I/O 0xfe10 (irq = 17) is a 16550A +[ 1.273468] 0000:00:08.0: ttyS7 at I/O 0xfe18 (irq = 17) is a 16550A +[ 1.293666] 0000:00:08.0: ttyS8 at I/O 0xfe20 (irq = 17) is a 16550A +[ 1.313863] 0000:00:08.0: ttyS9 at I/O 0xfe28 (irq = 17) is a 16550A +[ 1.334061] 0000:00:08.0: ttyS10 at I/O 0xfe30 (irq = 17) is a 16550A +[ 1.354258] 0000:00:08.0: ttyS11 at I/O 0xfe38 (irq = 17) is a 16550A + +Signed-off-by: Scott Ashcroft +[xr: Backported to 3.4: adjust context] +Signed-off-by: Rui Xiang +Signed-off-by: Greg Kroah-Hartman +--- + drivers/tty/serial/8250/8250_pci.c | 17 +++++++---------- + 1 file changed, 7 insertions(+), 10 deletions(-) + +--- a/drivers/tty/serial/8250/8250_pci.c ++++ b/drivers/tty/serial/8250/8250_pci.c +@@ -1154,6 +1154,7 @@ pci_xr17c154_setup(struct serial_private + + /* Unknown vendors/cards - this should not be in linux/pci_ids.h */ + #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584 0x1584 ++#define PCI_SUBDEVICE_ID_UNKNOWN_0x1588 0x1588 + + /* + * Master list of serial port init/setup/exit quirks. +@@ -1425,15 +1426,6 @@ static struct pci_serial_quirk pci_seria + }, + { + .vendor = PCI_VENDOR_ID_PLX, +- .device = PCI_DEVICE_ID_PLX_9050, +- .subvendor = PCI_VENDOR_ID_PLX, +- .subdevice = PCI_SUBDEVICE_ID_UNKNOWN_0x1584, +- .init = pci_plx9050_init, +- .setup = pci_default_setup, +- .exit = __devexit_p(pci_plx9050_exit), +- }, +- { +- .vendor = PCI_VENDOR_ID_PLX, + .device = PCI_DEVICE_ID_PLX_ROMULUS, + .subvendor = PCI_VENDOR_ID_PLX, + .subdevice = PCI_DEVICE_ID_PLX_ROMULUS, +@@ -3109,7 +3101,12 @@ static struct pci_device_id serial_pci_t + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_VENDOR_ID_PLX, + PCI_SUBDEVICE_ID_UNKNOWN_0x1584, 0, 0, +- pbn_b0_4_115200 }, ++ pbn_b2_4_115200 }, ++ /* Unknown card - subdevice 0x1588 */ ++ { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, ++ PCI_VENDOR_ID_PLX, ++ PCI_SUBDEVICE_ID_UNKNOWN_0x1588, 0, 0, ++ pbn_b2_8_115200 }, + { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_9050, + PCI_SUBVENDOR_ID_KEYSPAN, + PCI_SUBDEVICE_ID_KEYSPAN_SX2, 0, 0, diff --git a/queue-3.4/hpsa-gen8plus-smart-array-ids.patch b/queue-3.4/hpsa-gen8plus-smart-array-ids.patch new file mode 100644 index 00000000000..9f7028d52c1 --- /dev/null +++ b/queue-3.4/hpsa-gen8plus-smart-array-ids.patch @@ -0,0 +1,77 @@ +From fa1dd81ceffee58d0340a48c593ec5474e8e4f84 Mon Sep 17 00:00:00 2001 +From: Mike Miller +Date: Thu, 20 Sep 2012 16:05:18 -0500 +Subject: hpsa: gen8plus Smart Array IDs + +From: Mike Miller + +commit fe0c9610bb68dd0aad1017456f5e3c31264d70c2 upstream. + +Signed-off-by: James Bottomley +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/hpsa.c | 32 +++++++++++++++++++++++++------- + include/linux/pci_ids.h | 1 + + 2 files changed, 26 insertions(+), 7 deletions(-) + +--- a/drivers/scsi/hpsa.c ++++ b/drivers/scsi/hpsa.c +@@ -99,6 +99,15 @@ static const struct pci_device_id hpsa_p + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3354}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3355}, + {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x3356}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1920}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1921}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1922}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1923}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1924}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1925}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1926}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSH, 0x103C, 0x1928}, ++ {PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_CISSF, 0x103C, 0x334d}, + {PCI_VENDOR_ID_HP, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, + PCI_CLASS_STORAGE_RAID << 8, 0xffff << 8, 0}, + {0,} +@@ -118,13 +127,22 @@ static struct board_type products[] = { + {0x3249103C, "Smart Array P812", &SA5_access}, + {0x324a103C, "Smart Array P712m", &SA5_access}, + {0x324b103C, "Smart Array P711m", &SA5_access}, +- {0x3350103C, "Smart Array", &SA5_access}, +- {0x3351103C, "Smart Array", &SA5_access}, +- {0x3352103C, "Smart Array", &SA5_access}, +- {0x3353103C, "Smart Array", &SA5_access}, +- {0x3354103C, "Smart Array", &SA5_access}, +- {0x3355103C, "Smart Array", &SA5_access}, +- {0x3356103C, "Smart Array", &SA5_access}, ++ {0x3350103C, "Smart Array P222", &SA5_access}, ++ {0x3351103C, "Smart Array P420", &SA5_access}, ++ {0x3352103C, "Smart Array P421", &SA5_access}, ++ {0x3353103C, "Smart Array P822", &SA5_access}, ++ {0x3354103C, "Smart Array P420i", &SA5_access}, ++ {0x3355103C, "Smart Array P220i", &SA5_access}, ++ {0x3356103C, "Smart Array P721m", &SA5_access}, ++ {0x1920103C, "Smart Array", &SA5_access}, ++ {0x1921103C, "Smart Array", &SA5_access}, ++ {0x1922103C, "Smart Array", &SA5_access}, ++ {0x1923103C, "Smart Array", &SA5_access}, ++ {0x1924103C, "Smart Array", &SA5_access}, ++ {0x1925103C, "Smart Array", &SA5_access}, ++ {0x1926103C, "Smart Array", &SA5_access}, ++ {0x1928103C, "Smart Array", &SA5_access}, ++ {0x334d103C, "Smart Array P822se", &SA5_access}, + {0xFFFF103C, "Unknown Smart Array", &SA5_access}, + }; + +--- a/include/linux/pci_ids.h ++++ b/include/linux/pci_ids.h +@@ -752,6 +752,7 @@ + #define PCI_DEVICE_ID_HP_CISSD 0x3238 + #define PCI_DEVICE_ID_HP_CISSE 0x323a + #define PCI_DEVICE_ID_HP_CISSF 0x323b ++#define PCI_DEVICE_ID_HP_CISSH 0x323c + #define PCI_DEVICE_ID_HP_ZX2_IOC 0x4031 + + #define PCI_VENDOR_ID_PCTECH 0x1042 diff --git a/queue-3.4/isci-fix-a-race-condition-in-the-ssp-task-management-path.patch b/queue-3.4/isci-fix-a-race-condition-in-the-ssp-task-management-path.patch new file mode 100644 index 00000000000..447ec8fc199 --- /dev/null +++ b/queue-3.4/isci-fix-a-race-condition-in-the-ssp-task-management-path.patch @@ -0,0 +1,61 @@ +From 6af864ccfe6d6d079db3e488b77b95fa65eb7799 Mon Sep 17 00:00:00 2001 +From: Jeff Skirvin +Date: Thu, 11 Jul 2013 17:18:58 -0700 +Subject: isci: Fix a race condition in the SSP task management path + +From: Jeff Skirvin + +commit 96f15f29038e58e1b0a96483e2b369ff446becf1 upstream. + +This commit fixes a race condition in the isci driver abort task and SSP +device task management path. The race is caused when an I/O termination +in the SCU hardware is necessary because of an SSP target timeout condition, +and the check of the I/O end state races against the HW-termination-driven +end state. The failure of the race meant that no TMF was sent to the device +to clean-up the pending I/O. + +Signed-off-by: Jeff Skirvin +Reviewed-by: Lukasz Dorau +Signed-off-by: James Bottomley +[bwh: Backported to 3.2: adjust context] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/isci/task.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/isci/task.c ++++ b/drivers/scsi/isci/task.c +@@ -956,6 +956,7 @@ int isci_task_abort_task(struct sas_task + int ret = TMF_RESP_FUNC_FAILED; + unsigned long flags; + int perform_termination = 0; ++ int target_done_already = 0; + + /* Get the isci_request reference from the task. Note that + * this check does not depend on the pending request list +@@ -970,9 +971,11 @@ int isci_task_abort_task(struct sas_task + /* If task is already done, the request isn't valid */ + if (!(task->task_state_flags & SAS_TASK_STATE_DONE) && + (task->task_state_flags & SAS_TASK_AT_INITIATOR) && +- old_request) ++ old_request) { + isci_device = isci_lookup_device(task->dev); +- ++ target_done_already = test_bit(IREQ_COMPLETE_IN_TARGET, ++ &old_request->flags); ++ } + spin_unlock(&task->task_state_lock); + spin_unlock_irqrestore(&isci_host->scic_lock, flags); + +@@ -1031,7 +1034,7 @@ int isci_task_abort_task(struct sas_task + } + if (task->task_proto == SAS_PROTOCOL_SMP || + sas_protocol_ata(task->task_proto) || +- test_bit(IREQ_COMPLETE_IN_TARGET, &old_request->flags)) { ++ target_done_already) { + + spin_unlock_irqrestore(&isci_host->scic_lock, flags); + diff --git a/queue-3.4/iscsi-target-always-send-a-response-before-terminating-iscsi-connection.patch b/queue-3.4/iscsi-target-always-send-a-response-before-terminating-iscsi-connection.patch new file mode 100644 index 00000000000..8dc5225ee6c --- /dev/null +++ b/queue-3.4/iscsi-target-always-send-a-response-before-terminating-iscsi-connection.patch @@ -0,0 +1,75 @@ +From 9ef928b0104af7c05b03f6a40bffe225b4f4c9e4 Mon Sep 17 00:00:00 2001 +From: Roland Dreier +Date: Mon, 5 Nov 2012 18:02:42 -0800 +Subject: iscsi-target: Always send a response before terminating iSCSI connection + +From: Roland Dreier + +commit 1c5c12c666fda27c7c494b34934a0a0631a48130 upstream. + +There are some cases, for example when the initiator sends an +out-of-bounds ErrorRecoveryLevel value, where the iSCSI target +terminates the connection without sending back any error. Audit the +login path and add appropriate iscsit_tx_login_rsp() calls to make +sure this doesn't happen. + +Signed-off-by: Roland Dreier +Signed-off-by: Nicholas Bellinger +[bwh: Backported to 3.2: adjust context] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/iscsi/iscsi_target_login.c | 8 ++++---- + drivers/target/iscsi/iscsi_target_nego.c | 10 ++++++++-- + 2 files changed, 12 insertions(+), 6 deletions(-) + +--- a/drivers/target/iscsi/iscsi_target_login.c ++++ b/drivers/target/iscsi/iscsi_target_login.c +@@ -131,13 +131,13 @@ int iscsi_check_for_session_reinstatemen + + initiatorname_param = iscsi_find_param_from_key( + INITIATORNAME, conn->param_list); +- if (!initiatorname_param) +- return -1; +- + sessiontype_param = iscsi_find_param_from_key( + SESSIONTYPE, conn->param_list); +- if (!sessiontype_param) ++ if (!initiatorname_param || !sessiontype_param) { ++ iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, ++ ISCSI_LOGIN_STATUS_MISSING_FIELDS); + return -1; ++ } + + sessiontype = (strncmp(sessiontype_param->value, NORMAL, 6)) ? 1 : 0; + +--- a/drivers/target/iscsi/iscsi_target_nego.c ++++ b/drivers/target/iscsi/iscsi_target_nego.c +@@ -628,8 +628,11 @@ static int iscsi_target_handle_csg_one(s + login->req_buf, + payload_length, + conn->param_list); +- if (ret < 0) ++ if (ret < 0) { ++ iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, ++ ISCSI_LOGIN_STATUS_INIT_ERR); + return -1; ++ } + + if (login->first_request) + if (iscsi_target_check_first_request(conn, login) < 0) +@@ -644,8 +647,11 @@ static int iscsi_target_handle_csg_one(s + login->rsp_buf, + &login->rsp_length, + conn->param_list); +- if (ret < 0) ++ if (ret < 0) { ++ iscsit_tx_login_rsp(conn, ISCSI_STATUS_CLS_INITIATOR_ERR, ++ ISCSI_LOGIN_STATUS_INIT_ERR); + return -1; ++ } + + if (!login->auth_complete && + ISCSI_TPG_ATTRIB(ISCSI_TPG_C(conn))->authentication) { diff --git a/queue-3.4/mpt2sas-fix-for-device-scan-following-host-reset-could-get.patch b/queue-3.4/mpt2sas-fix-for-device-scan-following-host-reset-could-get.patch new file mode 100644 index 00000000000..9bdce863955 --- /dev/null +++ b/queue-3.4/mpt2sas-fix-for-device-scan-following-host-reset-could-get.patch @@ -0,0 +1,245 @@ +From e4498ad1ef9c7b3673efbeef5af0a3ef61a0ce07 Mon Sep 17 00:00:00 2001 +From: Sreekanth Reddy +Date: Sat, 2 Feb 2013 00:56:18 +0530 +Subject: mpt2sas: Fix for device scan following host reset could get + stuck in a infinite loop + +From: Sreekanth Reddy + +commit 6241f22ca12a26ee149cbe31b27bac97dbdc8bc4 upstream. + +Modified device scan routine so each configuration page read breaks from the +while loop when the ioc_status is not equal to MPI2_IOCSTATUS_SUCCESS. + +[jejb: checkpatch fixes] +Signed-off-by: Sreekanth Reddy +Signed-off-by: James Bottomley +[bwh: Backported to 3.2; adjust context] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/mpt2sas/mpt2sas_scsih.c | 118 ++++++++++++++++++++++++++++++++++- + 1 file changed, 115 insertions(+), 3 deletions(-) + +--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c ++++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c +@@ -7039,11 +7039,14 @@ _scsih_scan_for_devices_after_reset(stru + struct _sas_device *sas_device; + struct _sas_node *expander_device; + static struct _raid_device *raid_device; ++ u8 retry_count; + + printk(MPT2SAS_INFO_FMT "scan devices: start\n", ioc->name); + + _scsih_sas_host_refresh(ioc); + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: expanders start\n", ++ ioc->name); + /* expanders */ + handle = 0xFFFF; + while (!(mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0, +@@ -7052,19 +7055,39 @@ _scsih_scan_for_devices_after_reset(stru + MPI2_IOCSTATUS_MASK; + if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) + break; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from expander scan: " ++ "ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + handle = le16_to_cpu(expander_pg0.DevHandle); + expander_device = mpt2sas_scsih_expander_find_by_sas_address( + ioc, le64_to_cpu(expander_pg0.SASAddress)); + if (expander_device) + _scsih_refresh_expander_links(ioc, expander_device, + handle); +- else ++ else { ++ printk(MPT2SAS_INFO_FMT "\tBEFORE adding expander: " ++ "handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(expander_pg0.SASAddress)); + _scsih_expander_add(ioc, handle); ++ printk(MPT2SAS_INFO_FMT "\tAFTER adding expander: " ++ "handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(expander_pg0.SASAddress)); ++ } + } + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: expanders complete\n", ++ ioc->name); ++ + if (!ioc->ir_firmware) + goto skip_to_sas; + ++ printk(MPT2SAS_INFO_FMT "\tscan devices phys disk start\n", ioc->name); + /* phys disk */ + phys_disk_num = 0xFF; + while (!(mpt2sas_config_get_phys_disk_pg0(ioc, &mpi_reply, +@@ -7074,6 +7097,13 @@ _scsih_scan_for_devices_after_reset(stru + MPI2_IOCSTATUS_MASK; + if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) + break; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan:" ++ "ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + phys_disk_num = pd_pg0.PhysDiskNum; + handle = le16_to_cpu(pd_pg0.DevHandle); + sas_device = _scsih_sas_device_find_by_handle(ioc, handle); +@@ -7083,17 +7113,46 @@ _scsih_scan_for_devices_after_reset(stru + &sas_device_pg0, MPI2_SAS_DEVICE_PGAD_FORM_HANDLE, + handle) != 0) + continue; ++ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ++ MPI2_IOCSTATUS_MASK; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from phys disk scan " ++ "ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); + if (!_scsih_get_sas_address(ioc, parent_handle, + &sas_address)) { ++ printk(MPT2SAS_INFO_FMT "\tBEFORE adding phys disk: " ++ " handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(sas_device_pg0.SASAddress)); + mpt2sas_transport_update_links(ioc, sas_address, + handle, sas_device_pg0.PhyNum, + MPI2_SAS_NEG_LINK_RATE_1_5); + set_bit(handle, ioc->pd_handles); +- _scsih_add_device(ioc, handle, 0, 1); ++ retry_count = 0; ++ /* This will retry adding the end device. ++ * _scsih_add_device() will decide on retries and ++ * return "1" when it should be retried ++ */ ++ while (_scsih_add_device(ioc, handle, retry_count++, ++ 1)) { ++ ssleep(1); ++ } ++ printk(MPT2SAS_INFO_FMT "\tAFTER adding phys disk: " ++ " handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(sas_device_pg0.SASAddress)); + } + } + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: phys disk complete\n", ++ ioc->name); ++ ++ printk(MPT2SAS_INFO_FMT "\tscan devices: volumes start\n", ioc->name); + /* volumes */ + handle = 0xFFFF; + while (!(mpt2sas_config_get_raid_volume_pg1(ioc, &mpi_reply, +@@ -7102,6 +7161,13 @@ _scsih_scan_for_devices_after_reset(stru + MPI2_IOCSTATUS_MASK; + if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) + break; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: " ++ "ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + handle = le16_to_cpu(volume_pg1.DevHandle); + raid_device = _scsih_raid_device_find_by_wwid(ioc, + le64_to_cpu(volume_pg1.WWID)); +@@ -7111,18 +7177,38 @@ _scsih_scan_for_devices_after_reset(stru + &volume_pg0, MPI2_RAID_VOLUME_PGAD_FORM_HANDLE, handle, + sizeof(Mpi2RaidVolPage0_t))) + continue; ++ ioc_status = le16_to_cpu(mpi_reply.IOCStatus) & ++ MPI2_IOCSTATUS_MASK; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from volume scan: " ++ "ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + if (volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_OPTIMAL || + volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_ONLINE || + volume_pg0.VolumeState == MPI2_RAID_VOL_STATE_DEGRADED) { + memset(&element, 0, sizeof(Mpi2EventIrConfigElement_t)); + element.ReasonCode = MPI2_EVENT_IR_CHANGE_RC_ADDED; + element.VolDevHandle = volume_pg1.DevHandle; ++ printk(MPT2SAS_INFO_FMT "\tBEFORE adding volume: " ++ " handle (0x%04x)\n", ioc->name, ++ volume_pg1.DevHandle); + _scsih_sas_volume_add(ioc, &element); ++ printk(MPT2SAS_INFO_FMT "\tAFTER adding volume: " ++ " handle (0x%04x)\n", ioc->name, ++ volume_pg1.DevHandle); + } + } + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: volumes complete\n", ++ ioc->name); ++ + skip_to_sas: + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: end devices start\n", ++ ioc->name); + /* sas devices */ + handle = 0xFFFF; + while (!(mpt2sas_config_get_sas_device_pg0(ioc, &mpi_reply, +@@ -7132,6 +7218,13 @@ _scsih_scan_for_devices_after_reset(stru + MPI2_IOCSTATUS_MASK; + if (ioc_status == MPI2_IOCSTATUS_CONFIG_INVALID_PAGE) + break; ++ if (ioc_status != MPI2_IOCSTATUS_SUCCESS) { ++ printk(MPT2SAS_INFO_FMT "\tbreak from end device scan:" ++ " ioc_status(0x%04x), loginfo(0x%08x)\n", ++ ioc->name, ioc_status, ++ le32_to_cpu(mpi_reply.IOCLogInfo)); ++ break; ++ } + handle = le16_to_cpu(sas_device_pg0.DevHandle); + if (!(_scsih_is_end_device( + le32_to_cpu(sas_device_pg0.DeviceInfo)))) +@@ -7142,12 +7235,31 @@ _scsih_scan_for_devices_after_reset(stru + continue; + parent_handle = le16_to_cpu(sas_device_pg0.ParentDevHandle); + if (!_scsih_get_sas_address(ioc, parent_handle, &sas_address)) { ++ printk(MPT2SAS_INFO_FMT "\tBEFORE adding end device: " ++ "handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(sas_device_pg0.SASAddress)); + mpt2sas_transport_update_links(ioc, sas_address, handle, + sas_device_pg0.PhyNum, MPI2_SAS_NEG_LINK_RATE_1_5); +- _scsih_add_device(ioc, handle, 0, 0); ++ retry_count = 0; ++ /* This will retry adding the end device. ++ * _scsih_add_device() will decide on retries and ++ * return "1" when it should be retried ++ */ ++ while (_scsih_add_device(ioc, handle, retry_count++, ++ 0)) { ++ ssleep(1); ++ } ++ printk(MPT2SAS_INFO_FMT "\tAFTER adding end device: " ++ "handle (0x%04x), sas_addr(0x%016llx)\n", ++ ioc->name, handle, (unsigned long long) ++ le64_to_cpu(sas_device_pg0.SASAddress)); + } + } + ++ printk(MPT2SAS_INFO_FMT "\tscan devices: end devices complete\n", ++ ioc->name); ++ + printk(MPT2SAS_INFO_FMT "scan devices: complete\n", ioc->name); + } + diff --git a/queue-3.4/mpt2sas-fix-for-issue-missing-delay-not-getting-set-during-system-bootup.patch b/queue-3.4/mpt2sas-fix-for-issue-missing-delay-not-getting-set-during-system-bootup.patch new file mode 100644 index 00000000000..5a7ee157cb1 --- /dev/null +++ b/queue-3.4/mpt2sas-fix-for-issue-missing-delay-not-getting-set-during-system-bootup.patch @@ -0,0 +1,107 @@ +From 93cfcb8c998e3fe2c075fa61ab28f7b018e5049a Mon Sep 17 00:00:00 2001 +From: "Reddy, Sreekanth" +Date: Tue, 26 Feb 2013 16:59:59 +0530 +Subject: mpt2sas: Fix for issue Missing delay not getting set during system bootup + +From: "Reddy, Sreekanth" + +commit 93cfcb8c998e3fe2c075fa61ab28f7b018e5049a upstream. + +commit b0df96a0068daee4f9c2189c29b9053eb6e46b17 upstream. + +Missing delay is not getting set properly. The reason is that it is not +defined in the same file from where it is being invoked. The fix is to move +the missing delay module parameter from mpt2sas_base.c to mpt2sas_scsh.c. + +Signed-off-by: Sreekanth Reddy +Signed-off-by: James Bottomley +[bwh: Backported to 3.2: adjust context] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/mpt2sas/mpt2sas_base.c | 13 +++---------- + drivers/scsi/mpt2sas/mpt2sas_base.h | 3 +++ + drivers/scsi/mpt2sas/mpt2sas_scsih.c | 8 +++++++- + 3 files changed, 13 insertions(+), 11 deletions(-) + +--- a/drivers/scsi/mpt2sas/mpt2sas_base.c ++++ b/drivers/scsi/mpt2sas/mpt2sas_base.c +@@ -80,10 +80,6 @@ static int msix_disable = -1; + module_param(msix_disable, int, 0); + MODULE_PARM_DESC(msix_disable, " disable msix routed interrupts (default=0)"); + +-static int missing_delay[2] = {-1, -1}; +-module_param_array(missing_delay, int, NULL, 0); +-MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay"); +- + static int mpt2sas_fwfault_debug; + MODULE_PARM_DESC(mpt2sas_fwfault_debug, " enable detection of firmware fault " + "and halt firmware - (default=0)"); +@@ -2168,7 +2164,7 @@ _base_display_ioc_capabilities(struct MP + } + + /** +- * _base_update_missing_delay - change the missing delay timers ++ * mpt2sas_base_update_missing_delay - change the missing delay timers + * @ioc: per adapter object + * @device_missing_delay: amount of time till device is reported missing + * @io_missing_delay: interval IO is returned when there is a missing device +@@ -2179,8 +2175,8 @@ _base_display_ioc_capabilities(struct MP + * delay, as well as the io missing delay. This should be called at driver + * load time. + */ +-static void +-_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, ++void ++mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, + u16 device_missing_delay, u8 io_missing_delay) + { + u16 dmd, dmd_new, dmd_orignal; +@@ -4371,9 +4367,6 @@ mpt2sas_base_attach(struct MPT2SAS_ADAPT + if (r) + goto out_free_resources; + +- if (missing_delay[0] != -1 && missing_delay[1] != -1) +- _base_update_missing_delay(ioc, missing_delay[0], +- missing_delay[1]); + + return 0; + +--- a/drivers/scsi/mpt2sas/mpt2sas_base.h ++++ b/drivers/scsi/mpt2sas/mpt2sas_base.h +@@ -1047,6 +1047,9 @@ void mpt2sas_base_validate_event_type(st + + void mpt2sas_halt_firmware(struct MPT2SAS_ADAPTER *ioc); + ++void mpt2sas_base_update_missing_delay(struct MPT2SAS_ADAPTER *ioc, ++ u16 device_missing_delay, u8 io_missing_delay); ++ + int mpt2sas_port_enable(struct MPT2SAS_ADAPTER *ioc); + + /* scsih shared API */ +--- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c ++++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c +@@ -101,6 +101,10 @@ static ushort max_sectors = 0xFFFF; + module_param(max_sectors, ushort, 0); + MODULE_PARM_DESC(max_sectors, "max sectors, range 64 to 32767 default=32767"); + ++static int missing_delay[2] = {-1, -1}; ++module_param_array(missing_delay, int, NULL, 0); ++MODULE_PARM_DESC(missing_delay, " device missing delay , io missing delay"); ++ + /* scsi-mid layer global parmeter is max_report_luns, which is 511 */ + #define MPT2SAS_MAX_LUN (16895) + static int max_lun = MPT2SAS_MAX_LUN; +@@ -7351,7 +7355,9 @@ _firmware_event_work(struct work_struct + case MPT2SAS_PORT_ENABLE_COMPLETE: + ioc->start_scan = 0; + +- ++ if (missing_delay[0] != -1 && missing_delay[1] != -1) ++ mpt2sas_base_update_missing_delay(ioc, missing_delay[0], ++ missing_delay[1]); + + dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "port enable: complete " + "from worker thread\n", ioc->name)); diff --git a/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-dma-rx-path.patch b/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-dma-rx-path.patch new file mode 100644 index 00000000000..f4171361b16 --- /dev/null +++ b/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-dma-rx-path.patch @@ -0,0 +1,42 @@ +From 4f31ab80a2bf09ea0e57c351842da1e647cfe9da Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 10 Sep 2013 12:50:50 +0200 +Subject: serial: pch_uart: fix tty-kref leak in dma-rx path + +From: Johan Hovold + +commit 19b85cfb190eb9980eaf416bff96aef4159a430e upstream. + +Fix tty_kref leak when tty_buffer_request room fails in dma-rx path. + +Note that the tty ref isn't really needed anymore, but as the leak has +always been there, fixing it before removing should makes it easier to +backport the fix. + +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +[bwh: Backported to 3.2: adjust context] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/pch_uart.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -646,11 +646,12 @@ static int dma_push_rx(struct eg20t_port + dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", + size - room); + if (!room) +- return room; ++ goto out; + + tty_insert_flip_string(tty, sg_virt(&priv->sg_rx), size); + + port->icount.rx += room; ++out: + tty_kref_put(tty); + + return room; diff --git a/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-rx-error-path.patch b/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-rx-error-path.patch new file mode 100644 index 00000000000..d09ffd0538b --- /dev/null +++ b/queue-3.4/serial-pch_uart-fix-tty-kref-leak-in-rx-error-path.patch @@ -0,0 +1,33 @@ +From 73449fe73fa3d46232176fe6c73702b29b6479d2 Mon Sep 17 00:00:00 2001 +From: Johan Hovold +Date: Tue, 10 Sep 2013 12:50:49 +0200 +Subject: serial: pch_uart: fix tty-kref leak in rx-error path + +From: Johan Hovold + +commit fc0919c68cb2f75bb1af759315f9d7e2a9443c28 upstream. + +Fix tty-kref leak introduced by commit 384e301e ("pch_uart: fix a +deadlock when pch_uart as console") which never put its tty reference. + +Signed-off-by: Johan Hovold +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/serial/pch_uart.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/tty/serial/pch_uart.c ++++ b/drivers/tty/serial/pch_uart.c +@@ -1065,6 +1065,8 @@ static void pch_uart_err_ir(struct eg20t + if (tty == NULL) { + for (i = 0; error_msg[i] != NULL; i++) + dev_err(&priv->pdev->dev, error_msg[i]); ++ } else { ++ tty_kref_put(tty); + } + } + diff --git a/queue-3.4/series b/queue-3.4/series index 7ca9fd43f8b..36ead9f0843 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -60,3 +60,16 @@ nfsd-pass-net-to-__write_ports-and-down.patch nfsd-pass-proper-net-to-nfsd_destroy-from-nfsd-kthreads.patch nfsd-containerize-nfsd-filesystem.patch nfsd-check-passed-socket-s-net-matches-nfsd-superblock-s-one.patch +isci-fix-a-race-condition-in-the-ssp-task-management-path.patch +mpt2sas-fix-for-device-scan-following-host-reset-could-get.patch +mpt2sas-fix-for-issue-missing-delay-not-getting-set-during-system-bootup.patch +hpsa-gen8plus-smart-array-ids.patch +iscsi-target-always-send-a-response-before-terminating-iscsi-connection.patch +target-pscsi-fix-return-value-check.patch +target-fix-maintenance_in-service-action-cdb-checks-to-use-lower-5-bits.patch +target-use-correct-sense-code-for-lun-communication-failure.patch +target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch +serial-pch_uart-fix-tty-kref-leak-in-dma-rx-path.patch +serial-pch_uart-fix-tty-kref-leak-in-rx-error-path.patch +tty-correct-tty-buffer-flush.patch +fix-4-port-and-add-support-for-8-port-unknown-pci-serial-port-cards.patch diff --git a/queue-3.4/target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch b/queue-3.4/target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch new file mode 100644 index 00000000000..c472a896638 --- /dev/null +++ b/queue-3.4/target-file-fix-32-bit-highmem-breakage-for-sgl-iovec-mapping.patch @@ -0,0 +1,64 @@ +From 1506cb20191c0b33ae0c6cedac7a0ebf4fee3cf7 Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior +Date: Wed, 5 Dec 2012 12:08:29 +0100 +Subject: target/file: Fix 32-bit highmem breakage for SGL -> iovec mapping + +From: Sebastian Andrzej Siewior + +commit 40ff2c3b3da35dd3a00ac6722056a59b4b3f2caf upstream. + +This patch changes vectored file I/O to use kmap + kunmap when mapping +incoming SGL memory -> struct iovec in order to properly support 32-bit +highmem configurations. This is because an extra bounce buffer may be +required when processing scatterlist pages allocated with GFP_KERNEL. + +Signed-off-by: Sebastian Andrzej Siewior +Signed-off-by: Nicholas Bellinger +[bwh: Backported to 3.2: use task->task_sg{,_nents} for iteration] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/target_core_file.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/drivers/target/target_core_file.c ++++ b/drivers/target/target_core_file.c +@@ -299,7 +299,7 @@ static int fd_do_readv(struct se_task *t + + for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { + iov[i].iov_len = sg->length; +- iov[i].iov_base = sg_virt(sg); ++ iov[i].iov_base = kmap(sg_page(sg)) + sg->offset; + } + + old_fs = get_fs(); +@@ -307,6 +307,8 @@ static int fd_do_readv(struct se_task *t + ret = vfs_readv(fd, &iov[0], task->task_sg_nents, &pos); + set_fs(old_fs); + ++ for_each_sg(task->task_sg, sg, task->task_sg_nents, i) ++ kunmap(sg_page(sg)); + kfree(iov); + /* + * Return zeros and GOOD status even if the READ did not return +@@ -352,7 +354,7 @@ static int fd_do_writev(struct se_task * + + for_each_sg(task->task_sg, sg, task->task_sg_nents, i) { + iov[i].iov_len = sg->length; +- iov[i].iov_base = sg_virt(sg); ++ iov[i].iov_base = kmap(sg_page(sg)) + sg->offset; + } + + old_fs = get_fs(); +@@ -360,6 +362,9 @@ static int fd_do_writev(struct se_task * + ret = vfs_writev(fd, &iov[0], task->task_sg_nents, &pos); + set_fs(old_fs); + ++ for_each_sg(task->task_sg, sg, task->task_sg_nents, i) ++ kunmap(sg_page(sg)); ++ + kfree(iov); + + if (ret < 0 || ret != task->task_size) { diff --git a/queue-3.4/target-fix-maintenance_in-service-action-cdb-checks-to-use-lower-5-bits.patch b/queue-3.4/target-fix-maintenance_in-service-action-cdb-checks-to-use-lower-5-bits.patch new file mode 100644 index 00000000000..35e5f3fe42a --- /dev/null +++ b/queue-3.4/target-fix-maintenance_in-service-action-cdb-checks-to-use-lower-5-bits.patch @@ -0,0 +1,81 @@ +From d801775a8e97920ab0399c987e3b128ad88f8a9d Mon Sep 17 00:00:00 2001 +From: Nicholas Bellinger +Date: Wed, 16 May 2012 21:52:10 -0700 +Subject: target: Fix MAINTENANCE_IN service action CDB checks to use lower 5 bits + +From: Nicholas Bellinger + +commit ba539743b70cd160c84bab1c82910d0789b820f8 upstream. + +This patch fixes the MAINTENANCE_IN service action type checks to only +look at the proper lower 5 bits of cdb byte 1. This addresses the case +where MI_REPORT_TARGET_PGS w/ extended header using the upper three bits of +cdb byte 1 was not processed correctly in transport_generic_cmd_sequencer, +as well as the three cases for standby, unavailable, and transition ALUA +primary access state checks. + +Also add MAINTENANCE_IN to the excluded list in transport_generic_prepare_cdb() +to prevent the PARAMETER DATA FORMAT bits from being cleared. + +Cc: Hannes Reinecke +Cc: Rob Evers +Cc: Christoph Hellwig +Cc: Roland Dreier +Signed-off-by: Nicholas Bellinger +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/target_core_alua.c | 6 +++--- + drivers/target/target_core_transport.c | 3 ++- + 2 files changed, 5 insertions(+), 4 deletions(-) + +--- a/drivers/target/target_core_alua.c ++++ b/drivers/target/target_core_alua.c +@@ -394,7 +394,7 @@ static inline int core_alua_state_standb + case SEND_DIAGNOSTIC: + return 0; + case MAINTENANCE_IN: +- switch (cdb[1]) { ++ switch (cdb[1] & 0x1f) { + case MI_REPORT_TARGET_PGS: + return 0; + default: +@@ -437,7 +437,7 @@ static inline int core_alua_state_unavai + case REPORT_LUNS: + return 0; + case MAINTENANCE_IN: +- switch (cdb[1]) { ++ switch (cdb[1] & 0x1f) { + case MI_REPORT_TARGET_PGS: + return 0; + default: +@@ -478,7 +478,7 @@ static inline int core_alua_state_transi + case REPORT_LUNS: + return 0; + case MAINTENANCE_IN: +- switch (cdb[1]) { ++ switch (cdb[1] & 0x1f) { + case MI_REPORT_TARGET_PGS: + return 0; + default: +--- a/drivers/target/target_core_transport.c ++++ b/drivers/target/target_core_transport.c +@@ -1458,6 +1458,7 @@ static inline void transport_generic_pre + case VERIFY_16: /* SBC - VRProtect */ + case WRITE_VERIFY: /* SBC - VRProtect */ + case WRITE_VERIFY_12: /* SBC - VRProtect */ ++ case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */ + break; + default: + cdb[1] &= 0x1f; /* clear logical unit number */ +@@ -2813,7 +2814,7 @@ static int transport_generic_cmd_sequenc + /* + * Check for emulated MI_REPORT_TARGET_PGS. + */ +- if (cdb[1] == MI_REPORT_TARGET_PGS && ++ if ((cdb[1] & 0x1f) == MI_REPORT_TARGET_PGS && + su_dev->t10_alua.alua_type == SPC3_ALUA_EMULATED) { + cmd->execute_task = + target_emulate_report_target_port_groups; diff --git a/queue-3.4/target-pscsi-fix-return-value-check.patch b/queue-3.4/target-pscsi-fix-return-value-check.patch new file mode 100644 index 00000000000..5e7e9adf4de --- /dev/null +++ b/queue-3.4/target-pscsi-fix-return-value-check.patch @@ -0,0 +1,52 @@ +From 5874fd1d23ed9a7a49802c2cfeed8d57b9ae303d Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Fri, 25 Oct 2013 21:53:33 +0800 +Subject: target/pscsi: fix return value check + +From: Wei Yongjun + +commit 58932e96e438cd78f75e765d7b87ef39d3533d15 upstream. + +In case of error, the function scsi_host_lookup() returns NULL +pointer not ERR_PTR(). The IS_ERR() test in the return value check +should be replaced with NULL test. + +Signed-off-by: Wei Yongjun +Signed-off-by: Nicholas Bellinger +[bwh: Backported to 3.2: pscsi_configure_device() returns a pointer] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/target_core_pscsi.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/target/target_core_pscsi.c ++++ b/drivers/target/target_core_pscsi.c +@@ -128,10 +128,10 @@ static int pscsi_pmode_enable_hba(struct + * pSCSI Host ID and enable for phba mode + */ + sh = scsi_host_lookup(phv->phv_host_id); +- if (IS_ERR(sh)) { ++ if (!sh) { + pr_err("pSCSI: Unable to locate SCSI Host for" + " phv_host_id: %d\n", phv->phv_host_id); +- return PTR_ERR(sh); ++ return -EINVAL; + } + + phv->phv_lld_host = sh; +@@ -562,10 +562,10 @@ static struct se_device *pscsi_create_vi + sh = phv->phv_lld_host; + } else { + sh = scsi_host_lookup(pdv->pdv_host_id); +- if (IS_ERR(sh)) { ++ if (!sh) { + pr_err("pSCSI: Unable to locate" + " pdv_host_id: %d\n", pdv->pdv_host_id); +- return ERR_CAST(sh); ++ return ERR_PTR(-EINVAL); + } + } + } else { diff --git a/queue-3.4/target-use-correct-sense-code-for-lun-communication-failure.patch b/queue-3.4/target-use-correct-sense-code-for-lun-communication-failure.patch new file mode 100644 index 00000000000..4f36e181cd9 --- /dev/null +++ b/queue-3.4/target-use-correct-sense-code-for-lun-communication-failure.patch @@ -0,0 +1,35 @@ +From b60dc9751a36324ac4f68579d8dd3d415a58205e Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 17 Dec 2012 09:53:32 +0100 +Subject: target: use correct sense code for LUN communication failure + +From: Hannes Reinecke + +commit 18a9df42d53fabfa43b78be1104838cc8b9762e1 upstream. + +The ASC/ASCQ code for 'Logical Unit Communication failure' is +0x08/0x00; 0x80/0x00 is vendor specific. + +Signed-off-by: Hannes Reinecke +Cc: Nicholas Bellinger +Signed-off-by: Nicholas Bellinger +[bwh: Backported to 3.2: add offset to buffer index] +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/target/target_core_transport.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/target/target_core_transport.c ++++ b/drivers/target/target_core_transport.c +@@ -4702,7 +4702,7 @@ int transport_send_check_condition_and_s + /* ILLEGAL REQUEST */ + buffer[offset+SPC_SENSE_KEY_OFFSET] = ILLEGAL_REQUEST; + /* LOGICAL UNIT COMMUNICATION FAILURE */ +- buffer[offset+SPC_ASC_KEY_OFFSET] = 0x80; ++ buffer[offset+SPC_ASC_KEY_OFFSET] = 0x08; + break; + } + /* diff --git a/queue-3.4/tty-correct-tty-buffer-flush.patch b/queue-3.4/tty-correct-tty-buffer-flush.patch new file mode 100644 index 00000000000..aee49a7d13c --- /dev/null +++ b/queue-3.4/tty-correct-tty-buffer-flush.patch @@ -0,0 +1,46 @@ +From 689901ce9cedd2d34a5404dda146d0604cbc2a5e Mon Sep 17 00:00:00 2001 +From: Ilya Zykov +Date: Mon, 4 Mar 2013 23:19:41 +0400 +Subject: tty: Correct tty buffer flush. + +From: Ilya Zykov + +commit 64325a3be08d364a62ee8f84b2cf86934bc2544a upstream. + + The root of problem is carelessly zeroing pointer(in function __tty_buffer_flush()), +when another thread can use it. It can be cause of "NULL pointer dereference". + Main idea of the patch, this is never free last (struct tty_buffer) in the active buffer. +Only flush the data for ldisc(buf->head->read = buf->head->commit). +At that moment driver can collect(write) data in buffer without conflict. +It is repeat behavior of flush_to_ldisc(), only without feeding data to ldisc. + +Signed-off-by: Ilya Zykov +Signed-off-by: Ben Hutchings +Cc: Rui Xiang +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/tty/tty_buffer.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/tty/tty_buffer.c ++++ b/drivers/tty/tty_buffer.c +@@ -114,11 +114,14 @@ static void __tty_buffer_flush(struct tt + { + struct tty_buffer *thead; + +- while ((thead = tty->buf.head) != NULL) { +- tty->buf.head = thead->next; +- tty_buffer_free(tty, thead); ++ if (tty->buf.head == NULL) ++ return; ++ while ((thead = tty->buf.head->next) != NULL) { ++ tty_buffer_free(tty, tty->buf.head); ++ tty->buf.head = thead; + } +- tty->buf.tail = NULL; ++ WARN_ON(tty->buf.head != tty->buf.tail); ++ tty->buf.head->read = tty->buf.head->commit; + } + + /**