From: Greg Kroah-Hartman Date: Wed, 12 Apr 2017 13:48:48 +0000 (+0200) Subject: 4.10-stable patches X-Git-Tag: v4.10.11~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15e86c15bbedfb4f27527e2673a54e20f2e9acd3;p=thirdparty%2Fkernel%2Fstable-queue.git 4.10-stable patches added patches: crypto-caam-fix-invalid-dereference-in-caam_rsa_init_tfm.patch crypto-caam-fix-rng-deinstantiation-error-checking.patch mips-irq-stack-fix-erroneous-jal-to-plat_irq_dispatch.patch mips-select-have_irq_exit_on_irq_stack.patch mips-switch-to-the-irq_stack-in-interrupts.patch --- diff --git a/queue-4.10/crypto-caam-fix-invalid-dereference-in-caam_rsa_init_tfm.patch b/queue-4.10/crypto-caam-fix-invalid-dereference-in-caam_rsa_init_tfm.patch new file mode 100644 index 00000000000..f3d9e0cb102 --- /dev/null +++ b/queue-4.10/crypto-caam-fix-invalid-dereference-in-caam_rsa_init_tfm.patch @@ -0,0 +1,35 @@ +From 33fa46d7b310e06d2cb2ab5417c100af120bfb65 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Horia=20Geant=C4=83?= +Date: Mon, 3 Apr 2017 18:30:07 +0300 +Subject: crypto: caam - fix invalid dereference in caam_rsa_init_tfm() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Horia Geantă + +commit 33fa46d7b310e06d2cb2ab5417c100af120bfb65 upstream. + +In case caam_jr_alloc() fails, ctx->dev carries the error code, +thus accessing it with dev_err() is incorrect. + +Fixes: 8c419778ab57e ("crypto: caam - add support for RSA algorithm") +Signed-off-by: Horia Geantă +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/caam/caampkc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/crypto/caam/caampkc.c ++++ b/drivers/crypto/caam/caampkc.c +@@ -506,7 +506,7 @@ static int caam_rsa_init_tfm(struct cryp + ctx->dev = caam_jr_alloc(); + + if (IS_ERR(ctx->dev)) { +- dev_err(ctx->dev, "Job Ring Device allocation for transform failed\n"); ++ pr_err("Job Ring Device allocation for transform failed\n"); + return PTR_ERR(ctx->dev); + } + diff --git a/queue-4.10/crypto-caam-fix-rng-deinstantiation-error-checking.patch b/queue-4.10/crypto-caam-fix-rng-deinstantiation-error-checking.patch new file mode 100644 index 00000000000..4b5dec76045 --- /dev/null +++ b/queue-4.10/crypto-caam-fix-rng-deinstantiation-error-checking.patch @@ -0,0 +1,41 @@ +From 40c98cb57cdbc377456116ad4582c89e329721b0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Horia=20Geant=C4=83?= +Date: Wed, 5 Apr 2017 11:41:03 +0300 +Subject: crypto: caam - fix RNG deinstantiation error checking +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Horia Geantă + +commit 40c98cb57cdbc377456116ad4582c89e329721b0 upstream. + +RNG instantiation was previously fixed by +commit 62743a4145bb9 ("crypto: caam - fix RNG init descriptor ret. code checking") +while deinstantiation was not addressed. + +Since the descriptors used are similar, in the sense that they both end +with a JUMP HALT command, checking for errors should be similar too, +i.e. status code 7000_0000h should be considered successful. + +Fixes: 1005bccd7a4a6 ("crypto: caam - enable instantiation of all RNG4 state handles") +Signed-off-by: Horia Geantă +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/caam/ctrl.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/drivers/crypto/caam/ctrl.c ++++ b/drivers/crypto/caam/ctrl.c +@@ -282,7 +282,8 @@ static int deinstantiate_rng(struct devi + /* Try to run it through DECO0 */ + ret = run_descriptor_deco0(ctrldev, desc, &status); + +- if (ret || status) { ++ if (ret || ++ (status && status != JRSTA_SSRC_JUMP_HALT_CC)) { + dev_err(ctrldev, + "Failed to deinstantiate RNG4 SH%d\n", + sh_idx); diff --git a/queue-4.10/mips-irq-stack-fix-erroneous-jal-to-plat_irq_dispatch.patch b/queue-4.10/mips-irq-stack-fix-erroneous-jal-to-plat_irq_dispatch.patch new file mode 100644 index 00000000000..0694b5c0dd9 --- /dev/null +++ b/queue-4.10/mips-irq-stack-fix-erroneous-jal-to-plat_irq_dispatch.patch @@ -0,0 +1,42 @@ +From c25f8064c1d5731a2ce5664def890140dcdd3e5c Mon Sep 17 00:00:00 2001 +From: Matt Redfearn +Date: Wed, 25 Jan 2017 17:00:25 +0000 +Subject: MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch + +From: Matt Redfearn + +commit c25f8064c1d5731a2ce5664def890140dcdd3e5c upstream. + +Commit dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts") +changed both the normal and vectored interrupt handlers. Unfortunately +the vectored version, "except_vec_vi_handler", was incorrectly modified +to unconditionally jal to plat_irq_dispatch, rather than doing a jalr to +the vectored handler that has been set up. This is ok for many platforms +which set the vectored handler to plat_irq_dispatch anyway, but will +cause problems with platforms that use other handlers. + +Fixes: dda45f701c9d ("MIPS: Switch to the irq_stack in interrupts") +Signed-off-by: Matt Redfearn +Cc: Ralf Baechle +Cc: Paul Burton +Cc: linux-mips@linux-mips.org +Patchwork: https://patchwork.linux-mips.org/patch/15110/ +Signed-off-by: James Hogan +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/kernel/genex.S | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/mips/kernel/genex.S ++++ b/arch/mips/kernel/genex.S +@@ -329,7 +329,7 @@ NESTED(except_vec_vi_handler, 0, sp) + PTR_ADD sp, t0, t1 + + 2: +- jal plat_irq_dispatch ++ jalr v0 + + /* Restore sp */ + move sp, s1 diff --git a/queue-4.10/mips-select-have_irq_exit_on_irq_stack.patch b/queue-4.10/mips-select-have_irq_exit_on_irq_stack.patch new file mode 100644 index 00000000000..d55a538ce65 --- /dev/null +++ b/queue-4.10/mips-select-have_irq_exit_on_irq_stack.patch @@ -0,0 +1,37 @@ +From 3cc3434fd6307d06b53b98ce83e76bf9807689b9 Mon Sep 17 00:00:00 2001 +From: Matt Redfearn +Date: Mon, 19 Dec 2016 14:21:00 +0000 +Subject: MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK + +From: Matt Redfearn + +commit 3cc3434fd6307d06b53b98ce83e76bf9807689b9 upstream. + +Since do_IRQ is now invoked on a separate IRQ stack, we select +HAVE_IRQ_EXIT_ON_IRQ_STACK so that softirq's may be invoked directly +from irq_exit(), rather than requiring do_softirq_own_stack. + +Signed-off-by: Matt Redfearn +Acked-by: Jason A. Donenfeld +Cc: Thomas Gleixner +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/14744/ +Signed-off-by: Ralf Baechle +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/Kconfig | 1 + + 1 file changed, 1 insertion(+) + +--- a/arch/mips/Kconfig ++++ b/arch/mips/Kconfig +@@ -9,6 +9,7 @@ config MIPS + select HAVE_CONTEXT_TRACKING + select HAVE_GENERIC_DMA_COHERENT + select HAVE_IDE ++ select HAVE_IRQ_EXIT_ON_IRQ_STACK + select HAVE_OPROFILE + select HAVE_PERF_EVENTS + select PERF_USE_VMALLOC diff --git a/queue-4.10/mips-switch-to-the-irq_stack-in-interrupts.patch b/queue-4.10/mips-switch-to-the-irq_stack-in-interrupts.patch new file mode 100644 index 00000000000..013954ee56e --- /dev/null +++ b/queue-4.10/mips-switch-to-the-irq_stack-in-interrupts.patch @@ -0,0 +1,134 @@ +From dda45f701c9d7ad4ac0bb446e3a96f6df9a468d9 Mon Sep 17 00:00:00 2001 +From: Matt Redfearn +Date: Mon, 19 Dec 2016 14:20:59 +0000 +Subject: MIPS: Switch to the irq_stack in interrupts + +From: Matt Redfearn + +commit dda45f701c9d7ad4ac0bb446e3a96f6df9a468d9 upstream. + +When enterring interrupt context via handle_int or except_vec_vi, switch +to the irq_stack of the current CPU if it is not already in use. + +The current stack pointer is masked with the thread size and compared to +the base or the irq stack. If it does not match then the stack pointer +is set to the top of that stack, otherwise this is a nested irq being +handled on the irq stack so the stack pointer should be left as it was. + +The in-use stack pointer is placed in the callee saved register s1. It +will be saved to the stack when plat_irq_dispatch is invoked and can be +restored once control returns here. + +Signed-off-by: Matt Redfearn +Acked-by: Jason A. Donenfeld +Cc: Thomas Gleixner +Cc: James Hogan +Cc: Paul Burton +Cc: linux-mips@linux-mips.org +Cc: linux-kernel@vger.kernel.org +Patchwork: https://patchwork.linux-mips.org/patch/14743/ +Signed-off-by: Ralf Baechle +Signed-off-by: Amit Pundir +Signed-off-by: Greg Kroah-Hartman + +--- + arch/mips/kernel/genex.S | 81 ++++++++++++++++++++++++++++++++++++++++++++--- + 1 file changed, 76 insertions(+), 5 deletions(-) + +--- a/arch/mips/kernel/genex.S ++++ b/arch/mips/kernel/genex.S +@@ -187,9 +187,44 @@ NESTED(handle_int, PT_SIZE, sp) + + LONG_L s0, TI_REGS($28) + LONG_S sp, TI_REGS($28) +- PTR_LA ra, ret_from_irq +- PTR_LA v0, plat_irq_dispatch +- jr v0 ++ ++ /* ++ * SAVE_ALL ensures we are using a valid kernel stack for the thread. ++ * Check if we are already using the IRQ stack. ++ */ ++ move s1, sp # Preserve the sp ++ ++ /* Get IRQ stack for this CPU */ ++ ASM_CPUID_MFC0 k0, ASM_SMP_CPUID_REG ++#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) ++ lui k1, %hi(irq_stack) ++#else ++ lui k1, %highest(irq_stack) ++ daddiu k1, %higher(irq_stack) ++ dsll k1, 16 ++ daddiu k1, %hi(irq_stack) ++ dsll k1, 16 ++#endif ++ LONG_SRL k0, SMP_CPUID_PTRSHIFT ++ LONG_ADDU k1, k0 ++ LONG_L t0, %lo(irq_stack)(k1) ++ ++ # Check if already on IRQ stack ++ PTR_LI t1, ~(_THREAD_SIZE-1) ++ and t1, t1, sp ++ beq t0, t1, 2f ++ ++ /* Switch to IRQ stack */ ++ li t1, _IRQ_STACK_SIZE ++ PTR_ADD sp, t0, t1 ++ ++2: ++ jal plat_irq_dispatch ++ ++ /* Restore sp */ ++ move sp, s1 ++ ++ j ret_from_irq + #ifdef CONFIG_CPU_MICROMIPS + nop + #endif +@@ -262,8 +297,44 @@ NESTED(except_vec_vi_handler, 0, sp) + + LONG_L s0, TI_REGS($28) + LONG_S sp, TI_REGS($28) +- PTR_LA ra, ret_from_irq +- jr v0 ++ ++ /* ++ * SAVE_ALL ensures we are using a valid kernel stack for the thread. ++ * Check if we are already using the IRQ stack. ++ */ ++ move s1, sp # Preserve the sp ++ ++ /* Get IRQ stack for this CPU */ ++ ASM_CPUID_MFC0 k0, ASM_SMP_CPUID_REG ++#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) ++ lui k1, %hi(irq_stack) ++#else ++ lui k1, %highest(irq_stack) ++ daddiu k1, %higher(irq_stack) ++ dsll k1, 16 ++ daddiu k1, %hi(irq_stack) ++ dsll k1, 16 ++#endif ++ LONG_SRL k0, SMP_CPUID_PTRSHIFT ++ LONG_ADDU k1, k0 ++ LONG_L t0, %lo(irq_stack)(k1) ++ ++ # Check if already on IRQ stack ++ PTR_LI t1, ~(_THREAD_SIZE-1) ++ and t1, t1, sp ++ beq t0, t1, 2f ++ ++ /* Switch to IRQ stack */ ++ li t1, _IRQ_STACK_SIZE ++ PTR_ADD sp, t0, t1 ++ ++2: ++ jal plat_irq_dispatch ++ ++ /* Restore sp */ ++ move sp, s1 ++ ++ j ret_from_irq + END(except_vec_vi_handler) + + /* diff --git a/queue-4.10/series b/queue-4.10/series index caf7aa92f2f..e51d6c0af29 100644 --- a/queue-4.10/series +++ b/queue-4.10/series @@ -20,3 +20,8 @@ rt2x00usb-do-not-anchor-rx-and-tx-urb-s.patch mips-introduce-irq_stack.patch mips-stack-unwinding-while-on-irq-stack.patch mips-only-change-28-to-thread_info-if-coming-from-user-mode.patch +mips-switch-to-the-irq_stack-in-interrupts.patch +mips-select-have_irq_exit_on_irq_stack.patch +mips-irq-stack-fix-erroneous-jal-to-plat_irq_dispatch.patch +crypto-caam-fix-rng-deinstantiation-error-checking.patch +crypto-caam-fix-invalid-dereference-in-caam_rsa_init_tfm.patch