diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2019-04-12 11:14:15 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2019-04-18 10:15:04 -0400 |
commit | 8c3fffe3993b06dd1955a79bd2f0f3b143d259b3 (patch) | |
tree | 0a5d1f50aefb7ab51f2a6800e29d94e7b5a01702 /crypto/scompress.c | |
parent | f0cfd57b43fec65761ca61d3892b983a71515f23 (diff) |
crypto: scompress - initialize per-CPU variables on each CPU
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>
Diffstat (limited to 'crypto/scompress.c')
-rw-r--r-- | crypto/scompress.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/scompress.c b/crypto/scompress.c index da31f6fe1f83..712b4c2ea021 100644 --- a/crypto/scompress.c +++ b/crypto/scompress.c | |||
@@ -76,7 +76,7 @@ static void crypto_scomp_free_scratches(void) | |||
76 | int i; | 76 | int i; |
77 | 77 | ||
78 | for_each_possible_cpu(i) { | 78 | for_each_possible_cpu(i) { |
79 | scratch = raw_cpu_ptr(&scomp_scratch); | 79 | scratch = per_cpu_ptr(&scomp_scratch, i); |
80 | 80 | ||
81 | vfree(scratch->src); | 81 | vfree(scratch->src); |
82 | vfree(scratch->dst); | 82 | vfree(scratch->dst); |
@@ -93,7 +93,7 @@ static int crypto_scomp_alloc_scratches(void) | |||
93 | for_each_possible_cpu(i) { | 93 | for_each_possible_cpu(i) { |
94 | void *mem; | 94 | void *mem; |
95 | 95 | ||
96 | scratch = raw_cpu_ptr(&scomp_scratch); | 96 | scratch = per_cpu_ptr(&scomp_scratch, i); |
97 | 97 | ||
98 | mem = vmalloc_node(SCOMP_SCRATCH_SIZE, cpu_to_node(i)); | 98 | mem = vmalloc_node(SCOMP_SCRATCH_SIZE, cpu_to_node(i)); |
99 | if (!mem) | 99 | if (!mem) |