.. | .. |
---|
24 | 24 | #include <linux/cryptouser.h> |
---|
25 | 25 | #include <net/netlink.h> |
---|
26 | 26 | #include <linux/scatterlist.h> |
---|
| 27 | +#include <linux/locallock.h> |
---|
27 | 28 | #include <crypto/scatterwalk.h> |
---|
28 | 29 | #include <crypto/internal/acompress.h> |
---|
29 | 30 | #include <crypto/internal/scompress.h> |
---|
.. | .. |
---|
34 | 35 | static void * __percpu *scomp_dst_scratches; |
---|
35 | 36 | static int scomp_scratch_users; |
---|
36 | 37 | static DEFINE_MUTEX(scomp_lock); |
---|
| 38 | +static DEFINE_LOCAL_IRQ_LOCK(scomp_scratches_lock); |
---|
37 | 39 | |
---|
38 | 40 | #ifdef CONFIG_NET |
---|
39 | 41 | static int crypto_scomp_report(struct sk_buff *skb, struct crypto_alg *alg) |
---|
.. | .. |
---|
146 | 148 | void **tfm_ctx = acomp_tfm_ctx(tfm); |
---|
147 | 149 | struct crypto_scomp *scomp = *tfm_ctx; |
---|
148 | 150 | void **ctx = acomp_request_ctx(req); |
---|
149 | | - const int cpu = get_cpu(); |
---|
| 151 | + const int cpu = local_lock_cpu(scomp_scratches_lock); |
---|
150 | 152 | u8 *scratch_src = *per_cpu_ptr(scomp_src_scratches, cpu); |
---|
151 | 153 | u8 *scratch_dst = *per_cpu_ptr(scomp_dst_scratches, cpu); |
---|
152 | 154 | int ret; |
---|
.. | .. |
---|
181 | 183 | 1); |
---|
182 | 184 | } |
---|
183 | 185 | out: |
---|
184 | | - put_cpu(); |
---|
| 186 | + local_unlock_cpu(scomp_scratches_lock); |
---|
185 | 187 | return ret; |
---|
186 | 188 | } |
---|
187 | 189 | |
---|