From: Greg Kroah-Hartman Date: Mon, 12 Jul 2021 07:34:15 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v5.4.132~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7895e31a09fc754886dc3a970361b9a36877f7a9;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: cred-add-missing-return-error-code-when-set_cred_ucounts-failed.patch crypto-qce-fix-error-return-code-in-qce_skcipher_async_req_handle.patch iommu-dma-fix-compile-warning-in-32-bit-builds.patch powerpc-preempt-don-t-touch-the-idle-task-s-preempt_count-during-hotplug.patch s390-preempt-fix-preempt_count-initialization.patch --- diff --git a/queue-5.10/cred-add-missing-return-error-code-when-set_cred_ucounts-failed.patch b/queue-5.10/cred-add-missing-return-error-code-when-set_cred_ucounts-failed.patch new file mode 100644 index 00000000000..8a32e12a3e7 --- /dev/null +++ b/queue-5.10/cred-add-missing-return-error-code-when-set_cred_ucounts-failed.patch @@ -0,0 +1,35 @@ +From 5e6b8a50a7cec5686ee2c4bda1d49899c79a7eae Mon Sep 17 00:00:00 2001 +From: Yang Yingliang +Date: Wed, 26 May 2021 22:38:05 +0800 +Subject: cred: add missing return error code when set_cred_ucounts() failed + +From: Yang Yingliang + +commit 5e6b8a50a7cec5686ee2c4bda1d49899c79a7eae upstream. + +If set_cred_ucounts() failed, we need return the error code. + +Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred") +Reported-by: Hulk Robot +Signed-off-by: Yang Yingliang +Link: https://lkml.kernel.org/r/20210526143805.2549649-1-yangyingliang@huawei.com +Reviewed-by: Alexey Gladkov +Signed-off-by: Eric W. Biederman +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/cred.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/cred.c ++++ b/kernel/cred.c +@@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, un + ret = create_user_ns(new); + if (ret < 0) + goto error_put; +- if (set_cred_ucounts(new) < 0) ++ ret = set_cred_ucounts(new); ++ if (ret < 0) + goto error_put; + } + diff --git a/queue-5.10/crypto-qce-fix-error-return-code-in-qce_skcipher_async_req_handle.patch b/queue-5.10/crypto-qce-fix-error-return-code-in-qce_skcipher_async_req_handle.patch new file mode 100644 index 00000000000..190400820bc --- /dev/null +++ b/queue-5.10/crypto-qce-fix-error-return-code-in-qce_skcipher_async_req_handle.patch @@ -0,0 +1,45 @@ +From a8bc4f5e7a72e4067f5afd7e98b61624231713ca Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Wed, 2 Jun 2021 11:36:45 +0000 +Subject: crypto: qce - fix error return code in qce_skcipher_async_req_handle() + +From: Wei Yongjun + +commit a8bc4f5e7a72e4067f5afd7e98b61624231713ca upstream. + +Fix to return a negative error code from the error handling +case instead of 0, as done elsewhere in this function. + +Fixes: 1339a7c3ba05 ("crypto: qce: skcipher: Fix incorrect sg count for dma transfers") +Reported-by: Hulk Robot +Signed-off-by: Wei Yongjun +Reviewed-by: Thara Gopinath +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/crypto/qce/skcipher.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +--- a/drivers/crypto/qce/skcipher.c ++++ b/drivers/crypto/qce/skcipher.c +@@ -123,13 +123,17 @@ qce_skcipher_async_req_handle(struct cry + rctx->dst_sg = rctx->dst_tbl.sgl; + + dst_nents = dma_map_sg(qce->dev, rctx->dst_sg, rctx->dst_nents, dir_dst); +- if (dst_nents < 0) ++ if (dst_nents < 0) { ++ ret = dst_nents; + goto error_free; ++ } + + if (diff_dst) { + src_nents = dma_map_sg(qce->dev, req->src, rctx->src_nents, dir_src); +- if (src_nents < 0) ++ if (src_nents < 0) { ++ ret = src_nents; + goto error_unmap_dst; ++ } + rctx->src_sg = req->src; + } else { + rctx->src_sg = rctx->dst_sg; diff --git a/queue-5.10/iommu-dma-fix-compile-warning-in-32-bit-builds.patch b/queue-5.10/iommu-dma-fix-compile-warning-in-32-bit-builds.patch new file mode 100644 index 00000000000..51cf0d6c182 --- /dev/null +++ b/queue-5.10/iommu-dma-fix-compile-warning-in-32-bit-builds.patch @@ -0,0 +1,46 @@ +From 7154cbd31c2069726cf730b0ed94e2e79a221602 Mon Sep 17 00:00:00 2001 +From: Joerg Roedel +Date: Mon, 7 Jun 2021 14:49:05 +0200 +Subject: iommu/dma: Fix compile warning in 32-bit builds +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Joerg Roedel + +commit 7154cbd31c2069726cf730b0ed94e2e79a221602 upstream. + +Compiling the recent dma-iommu changes under 32-bit x86 triggers this +compile warning: + +drivers/iommu/dma-iommu.c:249:5: warning: format ‘%llx’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘phys_addr_t’ {aka ‘unsigned int’} [-Wformat=] + +The reason is that %llx is used to print a variable of type +phys_addr_t. Fix it by using the correct %pa format specifier for +phys_addr_t. + +Cc: Srinath Mannam +Cc: Robin Murphy +Cc: Oza Pawandeep +Fixes: 571f316074a20 ("iommu/dma: Fix IOVA reserve dma ranges") +Signed-off-by: Joerg Roedel +Link: https://lore.kernel.org/r/20210607124905.27525-1-joro@8bytes.org +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/iommu/dma-iommu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/drivers/iommu/dma-iommu.c ++++ b/drivers/iommu/dma-iommu.c +@@ -219,8 +219,8 @@ resv_iova: + } else if (end < start) { + /* dma_ranges list should be sorted */ + dev_err(&dev->dev, +- "Failed to reserve IOVA [%#010llx-%#010llx]\n", +- start, end); ++ "Failed to reserve IOVA [%pa-%pa]\n", ++ &start, &end); + return -EINVAL; + } + diff --git a/queue-5.10/powerpc-preempt-don-t-touch-the-idle-task-s-preempt_count-during-hotplug.patch b/queue-5.10/powerpc-preempt-don-t-touch-the-idle-task-s-preempt_count-during-hotplug.patch new file mode 100644 index 00000000000..393c6653254 --- /dev/null +++ b/queue-5.10/powerpc-preempt-don-t-touch-the-idle-task-s-preempt_count-during-hotplug.patch @@ -0,0 +1,62 @@ +From 2c669ef6979c370f98d4b876e54f19613c81e075 Mon Sep 17 00:00:00 2001 +From: Valentin Schneider +Date: Wed, 7 Jul 2021 19:38:31 +0100 +Subject: powerpc/preempt: Don't touch the idle task's preempt_count during hotplug + +From: Valentin Schneider + +commit 2c669ef6979c370f98d4b876e54f19613c81e075 upstream. + +Powerpc currently resets a CPU's idle task preempt_count to 0 before +said task starts executing the secondary startup routine (and becomes an +idle task proper). + +This conflicts with commit f1a0a376ca0c ("sched/core: Initialize the +idle task with preemption disabled"). + +which initializes all of the idle tasks' preempt_count to +PREEMPT_DISABLED during smp_init(). Note that this was superfluous +before said commit, as back then the hotplug machinery would invoke +init_idle() via idle_thread_get(), which would have already reset the +CPU's idle task's preempt_count to PREEMPT_ENABLED. + +Get rid of this preempt_count write. + +Fixes: f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled") +Reported-by: Bharata B Rao +Signed-off-by: Valentin Schneider +Tested-by: Guenter Roeck +Tested-by: Bharata B Rao +Signed-off-by: Michael Ellerman +Link: https://lore.kernel.org/r/20210707183831.2106509-1-valentin.schneider@arm.com +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/platforms/cell/smp.c | 3 --- + arch/powerpc/platforms/pseries/smp.c | 3 --- + 2 files changed, 6 deletions(-) + +--- a/arch/powerpc/platforms/cell/smp.c ++++ b/arch/powerpc/platforms/cell/smp.c +@@ -78,9 +78,6 @@ static inline int smp_startup_cpu(unsign + + pcpu = get_hard_smp_processor_id(lcpu); + +- /* Fixup atomic count: it exited inside IRQ handler. */ +- task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0; +- + /* + * If the RTAS start-cpu token does not exist then presume the + * cpu is already spinning. +--- a/arch/powerpc/platforms/pseries/smp.c ++++ b/arch/powerpc/platforms/pseries/smp.c +@@ -104,9 +104,6 @@ static inline int smp_startup_cpu(unsign + return 1; + } + +- /* Fixup atomic count: it exited inside IRQ handler. */ +- task_thread_info(paca_ptrs[lcpu]->__current)->preempt_count = 0; +- + /* + * If the RTAS start-cpu token does not exist then presume the + * cpu is already spinning. diff --git a/queue-5.10/s390-preempt-fix-preempt_count-initialization.patch b/queue-5.10/s390-preempt-fix-preempt_count-initialization.patch new file mode 100644 index 00000000000..b2035a186f3 --- /dev/null +++ b/queue-5.10/s390-preempt-fix-preempt_count-initialization.patch @@ -0,0 +1,97 @@ +From 6a942f5780545ebd11aca8b3ac4b163397962322 Mon Sep 17 00:00:00 2001 +From: Valentin Schneider +Date: Wed, 7 Jul 2021 17:33:38 +0100 +Subject: s390: preempt: Fix preempt_count initialization + +From: Valentin Schneider + +commit 6a942f5780545ebd11aca8b3ac4b163397962322 upstream. + +S390's init_idle_preempt_count(p, cpu) doesn't actually let us initialize the +preempt_count of the requested CPU's idle task: it unconditionally writes +to the current CPU's. This clearly conflicts with idle_threads_init(), +which intends to initialize *all* the idle tasks, including their +preempt_count (or their CPU's, if the arch uses a per-CPU preempt_count). + +Unfortunately, it seems the way s390 does things doesn't let us initialize +every possible CPU's preempt_count early on, as the pages where this +resides are only allocated when a CPU is brought up and are freed when it +is brought down. + +Let the arch-specific code set a CPU's preempt_count when its lowcore is +allocated, and turn init_idle_preempt_count() into an empty stub. + +Fixes: f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled") +Reported-by: Guenter Roeck +Signed-off-by: Valentin Schneider +Tested-by: Guenter Roeck +Reviewed-by: Heiko Carstens +Link: https://lore.kernel.org/r/20210707163338.1623014-1-valentin.schneider@arm.com +Signed-off-by: Vasily Gorbik +Signed-off-by: Greg Kroah-Hartman + +--- + arch/s390/include/asm/preempt.h | 16 ++++------------ + arch/s390/kernel/setup.c | 1 + + arch/s390/kernel/smp.c | 1 + + 3 files changed, 6 insertions(+), 12 deletions(-) + +--- a/arch/s390/include/asm/preempt.h ++++ b/arch/s390/include/asm/preempt.h +@@ -29,12 +29,6 @@ static inline void preempt_count_set(int + old, new) != old); + } + +-#define init_task_preempt_count(p) do { } while (0) +- +-#define init_idle_preempt_count(p, cpu) do { \ +- S390_lowcore.preempt_count = PREEMPT_DISABLED; \ +-} while (0) +- + static inline void set_preempt_need_resched(void) + { + __atomic_and(~PREEMPT_NEED_RESCHED, &S390_lowcore.preempt_count); +@@ -88,12 +82,6 @@ static inline void preempt_count_set(int + S390_lowcore.preempt_count = pc; + } + +-#define init_task_preempt_count(p) do { } while (0) +- +-#define init_idle_preempt_count(p, cpu) do { \ +- S390_lowcore.preempt_count = PREEMPT_DISABLED; \ +-} while (0) +- + static inline void set_preempt_need_resched(void) + { + } +@@ -130,6 +118,10 @@ static inline bool should_resched(int pr + + #endif /* CONFIG_HAVE_MARCH_Z196_FEATURES */ + ++#define init_task_preempt_count(p) do { } while (0) ++/* Deferred to CPU bringup time */ ++#define init_idle_preempt_count(p, cpu) do { } while (0) ++ + #ifdef CONFIG_PREEMPTION + extern asmlinkage void preempt_schedule(void); + #define __preempt_schedule() preempt_schedule() +--- a/arch/s390/kernel/setup.c ++++ b/arch/s390/kernel/setup.c +@@ -454,6 +454,7 @@ static void __init setup_lowcore_dat_off + lc->br_r1_trampoline = 0x07f1; /* br %r1 */ + lc->return_lpswe = gen_lpswe(__LC_RETURN_PSW); + lc->return_mcck_lpswe = gen_lpswe(__LC_RETURN_MCCK_PSW); ++ lc->preempt_count = PREEMPT_DISABLED; + + set_prefix((u32)(unsigned long) lc); + lowcore_ptr[0] = lc; +--- a/arch/s390/kernel/smp.c ++++ b/arch/s390/kernel/smp.c +@@ -215,6 +215,7 @@ static int pcpu_alloc_lowcore(struct pcp + lc->br_r1_trampoline = 0x07f1; /* br %r1 */ + lc->return_lpswe = gen_lpswe(__LC_RETURN_PSW); + lc->return_mcck_lpswe = gen_lpswe(__LC_RETURN_MCCK_PSW); ++ lc->preempt_count = PREEMPT_DISABLED; + if (nmi_alloc_per_cpu(lc)) + goto out_async; + if (vdso_alloc_per_cpu(lc)) diff --git a/queue-5.10/series b/queue-5.10/series index ba35ef3a00e..b0b8479c178 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -591,3 +591,8 @@ mmc-block-disable-cmdq-on-the-ioctl-path.patch mmc-vub3000-fix-control-request-direction.patch media-exynos4-is-remove-a-now-unused-integer.patch scsi-core-retry-i-o-for-notify-enable-spinup-required-error.patch +crypto-qce-fix-error-return-code-in-qce_skcipher_async_req_handle.patch +s390-preempt-fix-preempt_count-initialization.patch +cred-add-missing-return-error-code-when-set_cred_ucounts-failed.patch +iommu-dma-fix-compile-warning-in-32-bit-builds.patch +powerpc-preempt-don-t-touch-the-idle-task-s-preempt_count-during-hotplug.patch