[PATCH] Revert "crypto: scompress - serialize RT percpu scratch buffer access with a local lock"

Daniel Wagner
2024-02-02T17:11:45Z

This reverts commit 0cb152421350004d4dcf3a4523d88c002d0a7973.

The stable backport f8f261f9ade2 ("crypto: scompress - Use per-CPU
struct instead multiple variables") replaces this downstream workaround.

Signed-off-by: Daniel Wagner <wagi@monom.org>
---
crypto/scompress.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/crypto/scompress.c b/crypto/scompress.c
index c2f0077e0801..968bbcf65c94 100644
--- a/crypto/scompress.c
+++ b/crypto/scompress.c
@@ -24,7 +24,6 @@
#include <linux/cryptouser.h>
#include <net/netlink.h>
#include <linux/scatterlist.h>
-#include <linux/locallock.h>
#include <crypto/scatterwalk.h>
#include <crypto/internal/acompress.h>
#include <crypto/internal/scompress.h>
@@ -35,7 +34,6 @@ static void * __percpu *scomp_src_scratches;
static void * __percpu *scomp_dst_scratches;
static int scomp_scratch_users;
static DEFINE_MUTEX(scomp_lock);
-static DEFINE_LOCAL_IRQ_LOCK(scomp_scratches_lock);

#ifdef CONFIG_NET
static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg)
@@ -148,7 +146,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
void **tfm_ctx = acomp_tfm_ctx(tfm);
struct crypto_scomp *scomp = *tfm_ctx;
void **ctx = acomp_request_ctx(req);
- const int cpu = local_lock_cpu(scomp_scratches_lock);
+ const int cpu = get_cpu();
u8 *scratch_src = *per_cpu_ptr(scomp_src_scratches, cpu);
u8 *scratch_dst = *per_cpu_ptr(scomp_dst_scratches, cpu);
int ret;
@@ -183,7 +181,7 @@ static int scomp_acomp_comp_decomp(struct acomp_req *req, int dir)
1);
}
out:
- local_unlock_cpu(scomp_scratches_lock);
+ put_cpu();
return ret;
}

--
2.43.0