Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 's390-5.19-7' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux

Pull s390 fix from Alexander GordeevL

- Prevent relatively slow PRNO TRNG random number operation from being
called from interrupt context. That could for example cause some
network loads to timeout.

* tag 's390-5.19-7' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
s390/archrandom: prevent CPACF trng invocations in interrupt context

+6 -3
+6 -3
arch/s390/include/asm/archrandom.h
··· 2 2 /* 3 3 * Kernel interface for the s390 arch_random_* functions 4 4 * 5 - * Copyright IBM Corp. 2017, 2020 5 + * Copyright IBM Corp. 2017, 2022 6 6 * 7 7 * Author: Harald Freudenberger <freude@de.ibm.com> 8 8 * ··· 14 14 #ifdef CONFIG_ARCH_RANDOM 15 15 16 16 #include <linux/static_key.h> 17 + #include <linux/preempt.h> 17 18 #include <linux/atomic.h> 18 19 #include <asm/cpacf.h> 19 20 ··· 33 32 34 33 static inline bool __must_check arch_get_random_seed_long(unsigned long *v) 35 34 { 36 - if (static_branch_likely(&s390_arch_random_available)) { 35 + if (static_branch_likely(&s390_arch_random_available) && 36 + in_task()) { 37 37 cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v)); 38 38 atomic64_add(sizeof(*v), &s390_arch_random_counter); 39 39 return true; ··· 44 42 45 43 static inline bool __must_check arch_get_random_seed_int(unsigned int *v) 46 44 { 47 - if (static_branch_likely(&s390_arch_random_available)) { 45 + if (static_branch_likely(&s390_arch_random_available) && 46 + in_task()) { 48 47 cpacf_trng(NULL, 0, (u8 *)v, sizeof(*v)); 49 48 atomic64_add(sizeof(*v), &s390_arch_random_counter); 50 49 return true;