summaryrefslogtreecommitdiff
path: root/crypto/af_alg.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2015-03-23 16:41:44 -0400
committerDavid S. Miller <davem@davemloft.net>2015-03-23 16:41:44 -0400
commitf2b5e99d5f18373bd3f654e3e617cba1074dd8d7 (patch)
tree2cd509f29ca5790aaa05109e3e8fbaf42ab6c8fc /crypto/af_alg.c
parentfe3d8a25c02e0a82ac22dd41b374871e122eeb4b (diff)
parent34c08cc85c3814e3cf62237c1aca3c9c8c75cb8c (diff)
downloadlinux-crypto-f2b5e99d5f18373bd3f654e3e617cba1074dd8d7.tar.gz
linux-crypto-f2b5e99d5f18373bd3f654e3e617cba1074dd8d7.zip
Merge branch 'crypto_async'
Tadeusz Struk says: ==================== Add support for async socket operations After the iocb parameter has been removed from sendmsg() and recvmsg() ops the socket layer, and the network stack no longer support async operations. This patch set adds support for asynchronous operations on sockets back. Changes in v3: * As sugested by Al Viro instead of adding new functions aio_sendmsg and aio_recvmsg, added a ptr to iocb into the kernel-side msghdr structure. This way no change to aio.c is required. Changes in v2: * removed redundant total_size param from aio_sendmsg and aio_recvmsg functions ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--crypto/af_alg.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index 7f8b7edc..26089d18 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -358,8 +358,8 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
npages = (off + n + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (WARN_ON(npages == 0))
return -EINVAL;
-
- sg_init_table(sgl->sg, npages);
+ /* Add one extra for linking */
+ sg_init_table(sgl->sg, npages + 1);
for (i = 0, len = n; i < npages; i++) {
int plen = min_t(int, len, PAGE_SIZE - off);
@@ -369,18 +369,26 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
off = 0;
len -= plen;
}
+ sg_mark_end(sgl->sg + npages - 1);
+ sgl->npages = npages;
+
return n;
}
EXPORT_SYMBOL_GPL(af_alg_make_sg);
+void af_alg_link_sg(struct af_alg_sgl *sgl_prev, struct af_alg_sgl *sgl_new)
+{
+ sg_unmark_end(sgl_prev->sg + sgl_prev->npages - 1);
+ sg_chain(sgl_prev->sg, sgl_prev->npages + 1, sgl_new->sg);
+}
+EXPORT_SYMBOL(af_alg_link_sg);
+
void af_alg_free_sg(struct af_alg_sgl *sgl)
{
int i;
- i = 0;
- do {
+ for (i = 0; i < sgl->npages; i++)
put_page(sgl->pages[i]);
- } while (!sg_is_last(sgl->sg + (i++)));
}
EXPORT_SYMBOL_GPL(af_alg_free_sg);