From: Greg Kroah-Hartman Date: Sun, 6 Nov 2016 12:04:42 +0000 (+0100) Subject: 4.8-stable patches X-Git-Tag: v4.4.31~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7628f028b353b13cc54cfd83778e7375f3109f90;p=thirdparty%2Fkernel%2Fstable-queue.git 4.8-stable patches added patches: h8300-fix-syscall-restarting.patch spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch --- diff --git a/queue-4.8/h8300-fix-syscall-restarting.patch b/queue-4.8/h8300-fix-syscall-restarting.patch new file mode 100644 index 00000000000..a4b1be472b5 --- /dev/null +++ b/queue-4.8/h8300-fix-syscall-restarting.patch @@ -0,0 +1,65 @@ +From 21753583056d48a5fad964d6f272e28168426845 Mon Sep 17 00:00:00 2001 +From: Mark Rutland +Date: Thu, 27 Oct 2016 17:46:24 -0700 +Subject: h8300: fix syscall restarting + +From: Mark Rutland + +commit 21753583056d48a5fad964d6f272e28168426845 upstream. + +Back in commit f56141e3e2d9 ("all arches, signal: move restart_block to +struct task_struct"), all architectures and core code were changed to +use task_struct::restart_block. However, when h8300 support was +subsequently restored in v4.2, it was not updated to account for this, +and maintains thread_info::restart_block, which is not kept in sync. + +This patch drops the redundant restart_block from thread_info, and moves +h8300 to the common one in task_struct, ensuring that syscall restarting +always works as expected. + +Fixes: f56141e3e2d9 ("all arches, signal: move restart_block to struct task_struct") +Link: http://lkml.kernel.org/r/1476714934-11635-1-git-send-email-mark.rutland@arm.com +Signed-off-by: Mark Rutland +Cc: Andy Lutomirski +Cc: Yoshinori Sato +Cc: uclinux-h8-devel@lists.sourceforge.jp +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + arch/h8300/include/asm/thread_info.h | 4 ---- + arch/h8300/kernel/signal.c | 2 +- + 2 files changed, 1 insertion(+), 5 deletions(-) + +--- a/arch/h8300/include/asm/thread_info.h ++++ b/arch/h8300/include/asm/thread_info.h +@@ -31,7 +31,6 @@ struct thread_info { + int cpu; /* cpu we're on */ + int preempt_count; /* 0 => preemptable, <0 => BUG */ + mm_segment_t addr_limit; +- struct restart_block restart_block; + }; + + /* +@@ -44,9 +43,6 @@ struct thread_info { + .cpu = 0, \ + .preempt_count = INIT_PREEMPT_COUNT, \ + .addr_limit = KERNEL_DS, \ +- .restart_block = { \ +- .fn = do_no_restart_syscall, \ +- }, \ + } + + #define init_thread_info (init_thread_union.thread_info) +--- a/arch/h8300/kernel/signal.c ++++ b/arch/h8300/kernel/signal.c +@@ -79,7 +79,7 @@ restore_sigcontext(struct sigcontext *us + unsigned int er0; + + /* Always make any pending restarted system calls return -EINTR */ +- current_thread_info()->restart_block.fn = do_no_restart_syscall; ++ current->restart_block.fn = do_no_restart_syscall; + + /* restore passed registers */ + #define COPY(r) do { err |= get_user(regs->r, &usc->sc_##r); } while (0) diff --git a/queue-4.8/series b/queue-4.8/series index 58db32a6891..def6540c0d6 100644 --- a/queue-4.8/series +++ b/queue-4.8/series @@ -3,3 +3,6 @@ i2c-rk3x-give-the-tuning-value-0-during-rk3x_i2c_v0_calc_timings.patch i2c-xgene-avoid-dma_buffer-overrun.patch i2c-core-fix-null-pointer-dereference-under-race-condition.patch drm-dp-mst-clear-port-pdt-when-tearing-down-the-i2c-adapter.patch +spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch +spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch +h8300-fix-syscall-restarting.patch diff --git a/queue-4.8/spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch b/queue-4.8/spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch new file mode 100644 index 00000000000..e24261e485a --- /dev/null +++ b/queue-4.8/spi-fsl-espi-avoid-processing-uninitalized-data-on-error.patch @@ -0,0 +1,38 @@ +From 5c0ba57744b1422d528f19430dd66d6803cea86f Mon Sep 17 00:00:00 2001 +From: Arnd Bergmann +Date: Tue, 25 Oct 2016 22:57:10 +0200 +Subject: spi: fsl-espi: avoid processing uninitalized data on error + +From: Arnd Bergmann + +commit 5c0ba57744b1422d528f19430dd66d6803cea86f upstream. + +When we get a spurious interrupt in fsl_espi_irq, we end up +processing four uninitalized bytes of data, as shown in this +warning message: + + drivers/spi/spi-fsl-espi.c: In function 'fsl_espi_irq': + drivers/spi/spi-fsl-espi.c:462:4: warning: 'rx_data' may be used uninitialized in this function [-Wmaybe-uninitialized] + +This adds another check so we skip the data in this case. + +Fixes: 6319a68011b8 ("spi/fsl-espi: avoid infinite loops on fsl_espi_cpu_irq()") +Signed-off-by: Arnd Bergmann +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi-fsl-espi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/spi/spi-fsl-espi.c ++++ b/drivers/spi/spi-fsl-espi.c +@@ -581,7 +581,7 @@ void fsl_espi_cpu_irq(struct mpc8xxx_spi + + mspi->len -= rx_nr_bytes; + +- if (mspi->rx) ++ if (rx_nr_bytes && mspi->rx) + mspi->get_rx(rx_data, mspi); + } + diff --git a/queue-4.8/spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch b/queue-4.8/spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch new file mode 100644 index 00000000000..3396fccb2fb --- /dev/null +++ b/queue-4.8/spi-mark-device-nodes-only-in-case-of-successful-instantiation.patch @@ -0,0 +1,56 @@ +From e0af98a7e025a7263ae7e50264f6f79ed29642a7 Mon Sep 17 00:00:00 2001 +From: Ralf Ramsauer +Date: Mon, 17 Oct 2016 15:59:56 +0200 +Subject: spi: mark device nodes only in case of successful instantiation + +From: Ralf Ramsauer + +commit e0af98a7e025a7263ae7e50264f6f79ed29642a7 upstream. + +Instantiated SPI device nodes are marked with OF_POPULATE. This was +introduced in bd6c164. On unloading, loaded device nodes will of course +be unmarked. The problem are nodes that fail during initialisation: If a +node fails, it won't be unloaded and hence not be unmarked. + +If a SPI driver module is unloaded and reloaded, it will skip nodes that +failed before. + +Skip device nodes that are already populated and mark them only in case +of success. + +Note that the same issue exists for I2C. + +Fixes: bd6c164 ("spi: Mark instantiated device nodes with OF_POPULATE") +Signed-off-by: Ralf Ramsauer +Reviewed-by: Geert Uytterhoeven +Acked-by: Pantelis Antoniou +Signed-off-by: Mark Brown +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/spi/spi.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +--- a/drivers/spi/spi.c ++++ b/drivers/spi/spi.c +@@ -1607,9 +1607,11 @@ static void of_register_spi_devices(stru + if (of_node_test_and_set_flag(nc, OF_POPULATED)) + continue; + spi = of_register_spi_device(master, nc); +- if (IS_ERR(spi)) ++ if (IS_ERR(spi)) { + dev_warn(&master->dev, "Failed to create SPI device for %s\n", + nc->full_name); ++ of_node_clear_flag(nc, OF_POPULATED); ++ } + } + } + #else +@@ -3120,6 +3122,7 @@ static int of_spi_notify(struct notifier + if (IS_ERR(spi)) { + pr_err("%s: failed to create for '%s'\n", + __func__, rd->dn->full_name); ++ of_node_clear_flag(rd->dn, OF_POPULATED); + return notifier_from_errno(PTR_ERR(spi)); + } + break;