aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r--crypto/af_alg.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 85cea9de324a..358749c38894 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -1021,6 +1021,18 @@ unlock:
1021EXPORT_SYMBOL_GPL(af_alg_sendpage); 1021EXPORT_SYMBOL_GPL(af_alg_sendpage);
1022 1022
1023/** 1023/**
1024 * af_alg_free_resources - release resources required for crypto request
1025 */
1026void af_alg_free_resources(struct af_alg_async_req *areq)
1027{
1028 struct sock *sk = areq->sk;
1029
1030 af_alg_free_areq_sgls(areq);
1031 sock_kfree_s(sk, areq, areq->areqlen);
1032}
1033EXPORT_SYMBOL_GPL(af_alg_free_resources);
1034
1035/**
1024 * af_alg_async_cb - AIO callback handler 1036 * af_alg_async_cb - AIO callback handler
1025 * 1037 *
1026 * This handler cleans up the struct af_alg_async_req upon completion of the 1038 * This handler cleans up the struct af_alg_async_req upon completion of the
@@ -1036,18 +1048,13 @@ void af_alg_async_cb(struct crypto_async_request *_req, int err)
1036 struct kiocb *iocb = areq->iocb; 1048 struct kiocb *iocb = areq->iocb;
1037 unsigned int resultlen; 1049 unsigned int resultlen;
1038 1050
1039 lock_sock(sk);
1040
1041 /* Buffer size written by crypto operation. */ 1051 /* Buffer size written by crypto operation. */
1042 resultlen = areq->outlen; 1052 resultlen = areq->outlen;
1043 1053
1044 af_alg_free_areq_sgls(areq); 1054 af_alg_free_resources(areq);
1045 sock_kfree_s(sk, areq, areq->areqlen); 1055 sock_put(sk);
1046 __sock_put(sk);
1047 1056
1048 iocb->ki_complete(iocb, err ? err : resultlen, 0); 1057 iocb->ki_complete(iocb, err ? err : resultlen, 0);
1049
1050 release_sock(sk);
1051} 1058}
1052EXPORT_SYMBOL_GPL(af_alg_async_cb); 1059EXPORT_SYMBOL_GPL(af_alg_async_cb);
1053 1060