aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2023-06-06 14:08:56 +0100
committerPaolo Abeni <pabeni@redhat.com>2023-06-08 13:42:34 +0200
commitc662b043cdca89bf0f03fc37251000ac69a3a548 (patch)
treec9b24c0a2ad6e764faac98f2611687bdb5354c47 /crypto/af_alg.c
parentfb800fa4c1f5aee1238267252e88a7837e645c02 (diff)
downloadlinux-c662b043cdca89bf0f03fc37251000ac69a3a548.tar.gz
crypto: af_alg/hash: Support MSG_SPLICE_PAGES
Make AF_ALG sendmsg() support MSG_SPLICE_PAGES in the hashing code. This causes pages to be spliced from the source iterator if possible. This allows ->sendpage() to be replaced by something that can handle multiple multipage folios in a single transaction. Signed-off-by: David Howells <dhowells@redhat.com> cc: Herbert Xu <herbert@gondor.apana.org.au> cc: "David S. Miller" <davem@davemloft.net> cc: Eric Dumazet <edumazet@google.com> cc: Jakub Kicinski <kuba@kernel.org> cc: Paolo Abeni <pabeni@redhat.com> cc: Jens Axboe <axboe@kernel.dk> cc: Matthew Wilcox <willy@infradead.org> cc: linux-crypto@vger.kernel.org cc: netdev@vger.kernel.org Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'crypto/af_alg.c')
-rw-r--r--crypto/af_alg.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 3cf734835ccbf..7d4b6016b83d1 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -542,9 +542,14 @@ void af_alg_free_sg(struct af_alg_sgl *sgl)
{
int i;
- if (sgl->need_unpin)
- for (i = 0; i < sgl->sgt.nents; i++)
- unpin_user_page(sg_page(&sgl->sgt.sgl[i]));
+ if (sgl->sgt.sgl) {
+ if (sgl->need_unpin)
+ for (i = 0; i < sgl->sgt.nents; i++)
+ unpin_user_page(sg_page(&sgl->sgt.sgl[i]));
+ if (sgl->sgt.sgl != sgl->sgl)
+ kvfree(sgl->sgt.sgl);
+ sgl->sgt.sgl = NULL;
+ }
}
EXPORT_SYMBOL_GPL(af_alg_free_sg);