path: root/crypto/af_alg.c
diff options
authorLinus Torvalds <>2015-02-10 19:55:45 -0800
committerLinus Torvalds <>2015-02-10 19:55:45 -0800
commit9399f0c51489ae8c16d6559b82a452fdc1895e91 (patch)
treef99c8140dfb98082496ea2d457f9641ca8078daa /crypto/af_alg.c
parentb0f9ca53cbb103e9240a29a974e0b6085e58f9f7 (diff)
crypto: fix af_alg_make_sg() conversion to iov_iter
Commit 1d10eb2f156f ("crypto: switch af_alg_make_sg() to iov_iter") broke af_alg_make_sg() and skcipher_recvmsg() in the process of moving them to the iov_iter interfaces. The 'npages' calculation in the formar calculated the number of *bytes* in the pages, and in the latter case the conversion didn't re-read the value of 'ctx->used' after waiting for it to become non-zero. This reverts to the original code for both these cases. Cc: Al Viro <> Cc: David Miller <> Signed-off-by: Linus Torvalds <>
Diffstat (limited to 'crypto/af_alg.c')
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/af_alg.c b/crypto/af_alg.c
index eb78fe8a60c8..3e80d8b8be45 100644
--- a/crypto/af_alg.c
+++ b/crypto/af_alg.c
@@ -348,7 +348,7 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
if (n < 0)
return n;
- npages = PAGE_ALIGN(off + n);
+ npages = (off + n + PAGE_SIZE - 1) >> PAGE_SHIFT;
if (WARN_ON(npages == 0))
return -EINVAL;