hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/net/ceph/crypto.c
....@@ -46,9 +46,9 @@
4646 goto fail;
4747 }
4848
49
- /* crypto_alloc_skcipher() allocates with GFP_KERNEL */
49
+ /* crypto_alloc_sync_skcipher() allocates with GFP_KERNEL */
5050 noio_flag = memalloc_noio_save();
51
- key->tfm = crypto_alloc_skcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC);
51
+ key->tfm = crypto_alloc_sync_skcipher("cbc(aes)", 0, 0);
5252 memalloc_noio_restore(noio_flag);
5353 if (IS_ERR(key->tfm)) {
5454 ret = PTR_ERR(key->tfm);
....@@ -56,7 +56,7 @@
5656 goto fail;
5757 }
5858
59
- ret = crypto_skcipher_setkey(key->tfm, key->key, key->len);
59
+ ret = crypto_sync_skcipher_setkey(key->tfm, key->key, key->len);
6060 if (ret)
6161 goto fail;
6262
....@@ -136,8 +136,10 @@
136136 if (key) {
137137 kfree(key->key);
138138 key->key = NULL;
139
- crypto_free_skcipher(key->tfm);
140
- key->tfm = NULL;
139
+ if (key->tfm) {
140
+ crypto_free_sync_skcipher(key->tfm);
141
+ key->tfm = NULL;
142
+ }
141143 }
142144 }
143145
....@@ -216,7 +218,7 @@
216218 static int ceph_aes_crypt(const struct ceph_crypto_key *key, bool encrypt,
217219 void *buf, int buf_len, int in_len, int *pout_len)
218220 {
219
- SKCIPHER_REQUEST_ON_STACK(req, key->tfm);
221
+ SYNC_SKCIPHER_REQUEST_ON_STACK(req, key->tfm);
220222 struct sg_table sgt;
221223 struct scatterlist prealloc_sg;
222224 char iv[AES_BLOCK_SIZE] __aligned(8);
....@@ -232,7 +234,7 @@
232234 return ret;
233235
234236 memcpy(iv, aes_iv, AES_BLOCK_SIZE);
235
- skcipher_request_set_tfm(req, key->tfm);
237
+ skcipher_request_set_sync_tfm(req, key->tfm);
236238 skcipher_request_set_callback(req, 0, NULL, NULL);
237239 skcipher_request_set_crypt(req, sgt.sgl, sgt.sgl, crypt_len, iv);
238240