From: Greg Kroah-Hartman Date: Thu, 10 Dec 2009 19:03:01 +0000 (-0800) Subject: more .31 patches X-Git-Tag: v2.6.31.8~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1d0b6be59d064c279825cfd076b1f9363142af68;p=thirdparty%2Fkernel%2Fstable-queue.git more .31 patches --- diff --git a/queue-2.6.31/scsi-megaraid_sas-fix-64-bit-sense-pointer-truncation.patch b/queue-2.6.31/scsi-megaraid_sas-fix-64-bit-sense-pointer-truncation.patch new file mode 100644 index 00000000000..f936137a3fb --- /dev/null +++ b/queue-2.6.31/scsi-megaraid_sas-fix-64-bit-sense-pointer-truncation.patch @@ -0,0 +1,51 @@ +From 7b2519afa1abd1b9f63aa1e90879307842422dae Mon Sep 17 00:00:00 2001 +From: Yang, Bo +Date: Tue, 6 Oct 2009 14:52:20 -0600 +Subject: SCSI: megaraid_sas: fix 64 bit sense pointer truncation + +From: Yang, Bo + +commit 7b2519afa1abd1b9f63aa1e90879307842422dae upstream. + +The current sense pointer is cast to a u32 pointer, which can truncate +on 64 bits. Fix by using unsigned long instead. + +Signed-off-by Bo Yang +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/megaraid/megaraid_sas.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/megaraid/megaraid_sas.c ++++ b/drivers/scsi/megaraid/megaraid_sas.c +@@ -3032,7 +3032,7 @@ megasas_mgmt_fw_ioctl(struct megasas_ins + int error = 0, i; + void *sense = NULL; + dma_addr_t sense_handle; +- u32 *sense_ptr; ++ unsigned long *sense_ptr; + + memset(kbuff_arr, 0, sizeof(kbuff_arr)); + +@@ -3109,7 +3109,7 @@ megasas_mgmt_fw_ioctl(struct megasas_ins + } + + sense_ptr = +- (u32 *) ((unsigned long)cmd->frame + ioc->sense_off); ++ (unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off); + *sense_ptr = sense_handle; + } + +@@ -3140,8 +3140,8 @@ megasas_mgmt_fw_ioctl(struct megasas_ins + * sense_ptr points to the location that has the user + * sense buffer address + */ +- sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw + +- ioc->sense_off); ++ sense_ptr = (unsigned long *) ((unsigned long)ioc->frame.raw + ++ ioc->sense_off); + + if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)), + sense, ioc->sense_len)) { diff --git a/queue-2.6.31/scsi-osd_protocol.h-add-missing-include.patch b/queue-2.6.31/scsi-osd_protocol.h-add-missing-include.patch new file mode 100644 index 00000000000..151b31c278b --- /dev/null +++ b/queue-2.6.31/scsi-osd_protocol.h-add-missing-include.patch @@ -0,0 +1,32 @@ +From 0899638688f223fd9e9fee60d662665e11693d12 Mon Sep 17 00:00:00 2001 +From: Martin Michlmayr +Date: Mon, 16 Nov 2009 20:49:25 +0200 +Subject: SCSI: osd_protocol.h: Add missing #include + +From: Martin Michlmayr + +commit 0899638688f223fd9e9fee60d662665e11693d12 upstream. + +include/scsi/osd_protocol.h uses ALIGN() without an #include +, leading to: +| include/scsi/osd_protocol.h:362: error: implicit declaration of function 'ALIGN' + +Signed-off-by: Martin Michlmayr +Signed-off-by: Boaz Harrosh +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + include/scsi/osd_protocol.h | 1 + + 1 file changed, 1 insertion(+) + +--- a/include/scsi/osd_protocol.h ++++ b/include/scsi/osd_protocol.h +@@ -17,6 +17,7 @@ + #define __OSD_PROTOCOL_H__ + + #include ++#include + #include + #include + diff --git a/queue-2.6.31/scsi-scsi_lib_dma-fix-bug-with-dma-maps-on-nested-scsi-objects.patch b/queue-2.6.31/scsi-scsi_lib_dma-fix-bug-with-dma-maps-on-nested-scsi-objects.patch new file mode 100644 index 00000000000..efa5d9a7c30 --- /dev/null +++ b/queue-2.6.31/scsi-scsi_lib_dma-fix-bug-with-dma-maps-on-nested-scsi-objects.patch @@ -0,0 +1,153 @@ +From d139b9bd0e52dda14fd13412e7096e68b56d0076 Mon Sep 17 00:00:00 2001 +From: James Bottomley +Date: Thu, 5 Nov 2009 13:33:12 -0600 +Subject: SCSI: scsi_lib_dma: fix bug with dma maps on nested scsi objects + +From: James Bottomley + +commit d139b9bd0e52dda14fd13412e7096e68b56d0076 upstream. + +Some of our virtual SCSI hosts don't have a proper bus parent at the +top, which can be a problem for doing DMA on them + +This patch makes the host device cache a pointer to the physical bus +device and provides an extra API for setting it (the normal API picks +it up from the parent). This patch also modifies the qla2xxx and lpfc +vport logic to use the new DMA host setting API. + +Acked-By: James Smart +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/hosts.c | 13 ++++++++++--- + drivers/scsi/lpfc/lpfc_init.c | 2 +- + drivers/scsi/qla2xxx/qla_attr.c | 3 ++- + drivers/scsi/scsi_lib_dma.c | 4 ++-- + include/scsi/scsi_host.h | 16 +++++++++++++++- + 5 files changed, 30 insertions(+), 8 deletions(-) + +--- a/drivers/scsi/hosts.c ++++ b/drivers/scsi/hosts.c +@@ -180,14 +180,20 @@ void scsi_remove_host(struct Scsi_Host * + EXPORT_SYMBOL(scsi_remove_host); + + /** +- * scsi_add_host - add a scsi host ++ * scsi_add_host_with_dma - add a scsi host with dma device + * @shost: scsi host pointer to add + * @dev: a struct device of type scsi class ++ * @dma_dev: dma device for the host ++ * ++ * Note: You rarely need to worry about this unless you're in a ++ * virtualised host environments, so use the simpler scsi_add_host() ++ * function instead. + * + * Return value: + * 0 on success / != 0 for error + **/ +-int scsi_add_host(struct Scsi_Host *shost, struct device *dev) ++int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev, ++ struct device *dma_dev) + { + struct scsi_host_template *sht = shost->hostt; + int error = -EINVAL; +@@ -207,6 +213,7 @@ int scsi_add_host(struct Scsi_Host *shos + + if (!shost->shost_gendev.parent) + shost->shost_gendev.parent = dev ? dev : &platform_bus; ++ shost->dma_dev = dma_dev; + + error = device_add(&shost->shost_gendev); + if (error) +@@ -262,7 +269,7 @@ int scsi_add_host(struct Scsi_Host *shos + fail: + return error; + } +-EXPORT_SYMBOL(scsi_add_host); ++EXPORT_SYMBOL(scsi_add_host_with_dma); + + static void scsi_host_dev_release(struct device *dev) + { +--- a/drivers/scsi/lpfc/lpfc_init.c ++++ b/drivers/scsi/lpfc/lpfc_init.c +@@ -2384,7 +2384,7 @@ lpfc_create_port(struct lpfc_hba *phba, + vport->els_tmofunc.function = lpfc_els_timeout; + vport->els_tmofunc.data = (unsigned long)vport; + +- error = scsi_add_host(shost, dev); ++ error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev); + if (error) + goto out_put_shost; + +--- a/drivers/scsi/qla2xxx/qla_attr.c ++++ b/drivers/scsi/qla2xxx/qla_attr.c +@@ -1654,7 +1654,8 @@ qla24xx_vport_create(struct fc_vport *fc + fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN); + } + +- if (scsi_add_host(vha->host, &fc_vport->dev)) { ++ if (scsi_add_host_with_dma(vha->host, &fc_vport->dev, ++ &ha->pdev->dev)) { + DEBUG15(printk("scsi(%ld): scsi_add_host failure for VP[%d].\n", + vha->host_no, vha->vp_idx)); + goto vport_create_failed_2; +--- a/drivers/scsi/scsi_lib_dma.c ++++ b/drivers/scsi/scsi_lib_dma.c +@@ -23,7 +23,7 @@ int scsi_dma_map(struct scsi_cmnd *cmd) + int nseg = 0; + + if (scsi_sg_count(cmd)) { +- struct device *dev = cmd->device->host->shost_gendev.parent; ++ struct device *dev = cmd->device->host->dma_dev; + + nseg = dma_map_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd), + cmd->sc_data_direction); +@@ -41,7 +41,7 @@ EXPORT_SYMBOL(scsi_dma_map); + void scsi_dma_unmap(struct scsi_cmnd *cmd) + { + if (scsi_sg_count(cmd)) { +- struct device *dev = cmd->device->host->shost_gendev.parent; ++ struct device *dev = cmd->device->host->dma_dev; + + dma_unmap_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd), + cmd->sc_data_direction); +--- a/include/scsi/scsi_host.h ++++ b/include/scsi/scsi_host.h +@@ -677,6 +677,12 @@ struct Scsi_Host { + void *shost_data; + + /* ++ * Points to the physical bus device we'd use to do DMA ++ * Needed just in case we have virtual hosts. ++ */ ++ struct device *dma_dev; ++ ++ /* + * We should ensure that this is aligned, both for better performance + * and also because some compilers (m68k) don't automatically force + * alignment to a long boundary. +@@ -720,7 +726,9 @@ extern int scsi_queue_work(struct Scsi_H + extern void scsi_flush_work(struct Scsi_Host *); + + extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int); +-extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *); ++extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *, ++ struct device *, ++ struct device *); + extern void scsi_scan_host(struct Scsi_Host *); + extern void scsi_rescan_device(struct device *); + extern void scsi_remove_host(struct Scsi_Host *); +@@ -731,6 +739,12 @@ extern const char *scsi_host_state_name( + + extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *); + ++static inline int __must_check scsi_add_host(struct Scsi_Host *host, ++ struct device *dev) ++{ ++ return scsi_add_host_with_dma(host, dev, dev); ++} ++ + static inline struct device *scsi_get_device(struct Scsi_Host *shost) + { + return shost->shost_gendev.parent; diff --git a/queue-2.6.31/series b/queue-2.6.31/series index 0ac4db7f91e..19216e40afb 100644 --- a/queue-2.6.31/series +++ b/queue-2.6.31/series @@ -83,3 +83,7 @@ 0083-ext4-fix-incorrect-block-reservation-on-quota-transf.patch 0084-ext4-Wait-for-proper-transaction-commit-on-fsync.patch 0085-ext4-Fix-insufficient-checks-in-EXT4_IOC_MOVE_EXT.patch +scsi-megaraid_sas-fix-64-bit-sense-pointer-truncation.patch +scsi-osd_protocol.h-add-missing-include.patch +scsi-scsi_lib_dma-fix-bug-with-dma-maps-on-nested-scsi-objects.patch +signal-fix-alternate-signal-stack-check.patch diff --git a/queue-2.6.31/signal-fix-alternate-signal-stack-check.patch b/queue-2.6.31/signal-fix-alternate-signal-stack-check.patch new file mode 100644 index 00000000000..c095cefd828 --- /dev/null +++ b/queue-2.6.31/signal-fix-alternate-signal-stack-check.patch @@ -0,0 +1,87 @@ +From 2a855dd01bc1539111adb7233f587c5c468732ac Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior +Date: Sun, 25 Oct 2009 15:37:58 +0100 +Subject: signal: Fix alternate signal stack check + +From: Sebastian Andrzej Siewior + +commit 2a855dd01bc1539111adb7233f587c5c468732ac upstream. + +All architectures in the kernel increment/decrement the stack pointer +before storing values on the stack. + +On architectures which have the stack grow down sas_ss_sp == sp is not +on the alternate signal stack while sas_ss_sp + sas_ss_size == sp is +on the alternate signal stack. + +On architectures which have the stack grow up sas_ss_sp == sp is on +the alternate signal stack while sas_ss_sp + sas_ss_size == sp is not +on the alternate signal stack. + +The current implementation fails for architectures which have the +stack grow down on the corner case where sas_ss_sp == sp.This was +reported as Debian bug #544905 on AMD64. +Simplified test case: http://download.breakpoint.cc/tc-sig-stack.c + +The test case creates the following stack scenario: + 0xn0300 stack top + 0xn0200 alt stack pointer top (when switching to alt stack) + 0xn01ff alt stack end + 0xn0100 alt stack start == stack pointer + +If the signal is sent the stack pointer is pointing to the base +address of the alt stack and the kernel erroneously decides that it +has already switched to the alternate stack because of the current +check for "sp - sas_ss_sp < sas_ss_size" + +On parisc (stack grows up) the scenario would be: + 0xn0200 stack pointer + 0xn01ff alt stack end + 0xn0100 alt stack start = alt stack pointer base + (when switching to alt stack) + 0xn0000 stack base + +This is handled correctly by the current implementation. + +[ tglx: Modified for archs which have the stack grow up (parisc) which + would fail with the correct implementation for stack grows + down. Added a check for sp >= current->sas_ss_sp which is + strictly not necessary but makes the code symetric for both + variants ] + +Signed-off-by: Sebastian Andrzej Siewior +Cc: Oleg Nesterov +Cc: Roland McGrath +Cc: Kyle McMartin +LKML-Reference: <20091025143758.GA6653@Chamillionaire.breakpoint.cc> +Signed-off-by: Thomas Gleixner +Signed-off-by: Greg Kroah-Hartman + +--- + include/linux/sched.h | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -1999,11 +1999,18 @@ static inline int is_si_special(const st + return info <= SEND_SIG_FORCED; + } + +-/* True if we are on the alternate signal stack. */ +- ++/* ++ * True if we are on the alternate signal stack. ++ */ + static inline int on_sig_stack(unsigned long sp) + { +- return (sp - current->sas_ss_sp < current->sas_ss_size); ++#ifdef CONFIG_STACK_GROWSUP ++ return sp >= current->sas_ss_sp && ++ sp - current->sas_ss_sp < current->sas_ss_size; ++#else ++ return sp > current->sas_ss_sp && ++ sp - current->sas_ss_sp <= current->sas_ss_size; ++#endif + } + + static inline int sas_ss_flags(unsigned long sp)