From fd2c250a9b9729494e2ba02bfaabfcb160f62387 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 22 Jan 2024 15:44:40 -0800 Subject: [PATCH] 4.19-stable patches added patches: crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch --- ...ialize-per-cpu-variables-on-each-cpu.patch | 48 +++++++++++++++++++ queue-4.19/series | 1 + 2 files changed, 49 insertions(+) create mode 100644 queue-4.19/crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch diff --git a/queue-4.19/crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch b/queue-4.19/crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch new file mode 100644 index 00000000000..1018a99ecb2 --- /dev/null +++ b/queue-4.19/crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch @@ -0,0 +1,48 @@ +From 8c3fffe3993b06dd1955a79bd2f0f3b143d259b3 Mon Sep 17 00:00:00 2001 +From: Sebastian Andrzej Siewior +Date: Fri, 12 Apr 2019 17:14:15 +0200 +Subject: crypto: scompress - initialize per-CPU variables on each CPU + +From: Sebastian Andrzej Siewior + +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 +Signed-off-by: Sebastian Andrzej Siewior +Tested-by: Guenter Roeck +Signed-off-by: Herbert Xu +Signed-off-by: Greg Kroah-Hartman +--- + crypto/scompress.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/crypto/scompress.c ++++ b/crypto/scompress.c +@@ -79,7 +79,7 @@ static void crypto_scomp_free_scratches( + 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( + 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) diff --git a/queue-4.19/series b/queue-4.19/series index 7abeeb208b7..fb98c85cf7e 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -145,3 +145,4 @@ kdb-fix-a-potential-buffer-overflow-in-kdb_local.patch i2c-s3c24xx-fix-read-transfers-in-polling-mode.patch i2c-s3c24xx-fix-transferring-more-than-one-message-i.patch revert-nfsd-fix-possible-sleep-during-nfsd4_release_lockowner.patch +crypto-scompress-initialize-per-cpu-variables-on-each-cpu.patch -- 2.47.3