summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2019-04-12 17:14:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-01-25 14:33:39 -0800
commita132ff91717c28498c602e62824f0684a02c8832 (patch)
tree0cff5251b58f6fbce242c6079df260412fd6fec5
parent10d75984495f7fe62152c3b0dbfa3f0a6b739c9b (diff)
crypto: scompress - initialize per-CPU variables on each CPU
commit 8c3fffe3993b06dd1955a79bd2f0f3b143d259b3 upstream. In commit 71052dcf4be70 ("crypto: scompress - Use per-CPU struct instead multiple variables") I accidentally initialized multiple times the memory on a random CPU. I should have initialize the memory on every CPU like it has been done earlier. I didn't notice this because the scheduler didn't move the task to another CPU. Guenter managed to do that and the code crashed as expected. Allocate / free per-CPU memory on each CPU. Fixes: 71052dcf4be70 ("crypto: scompress - Use per-CPU struct instead multiple variables") Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Tested-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--crypto/scompress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/scompress.c b/crypto/scompress.c
index 34174f55a6d6..839067636fb7 100644
--- a/crypto/scompress.c
+++ b/crypto/scompress.c
@@ -79,7 +79,7 @@ static void crypto_scomp_free_scratches(void)
int i;
for_each_possible_cpu(i) {
- scratch = raw_cpu_ptr(&scomp_scratch);
+ scratch = per_cpu_ptr(&scomp_scratch, i);
vfree(scratch->src);
vfree(scratch->dst);
@@ -96,7 +96,7 @@ static int crypto_scomp_alloc_scratches(void)
for_each_possible_cpu(i) {
void *mem;
- scratch = raw_cpu_ptr(&scomp_scratch);
+ scratch = per_cpu_ptr(&scomp_scratch, i);
mem = vmalloc_node(SCOMP_SCRATCH_SIZE, cpu_to_node(i));
if (!mem)