Commit 750d8065 authored by Al Viro's avatar Al Viro Committed by David S. Miller

crypto: Fix regressions caused by iov_iter changes.

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b0f9ca53
...@@ -348,7 +348,7 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len) ...@@ -348,7 +348,7 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
if (n < 0) if (n < 0)
return n; return n;
npages = PAGE_ALIGN(off + n); npages = DIV_ROUND_UP(off + n, PAGE_SIZE);
if (WARN_ON(npages == 0)) if (WARN_ON(npages == 0))
return -EINVAL; return -EINVAL;
......
...@@ -427,11 +427,11 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock, ...@@ -427,11 +427,11 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
struct skcipher_sg_list *sgl; struct skcipher_sg_list *sgl;
struct scatterlist *sg; struct scatterlist *sg;
int err = -EAGAIN; int err = -EAGAIN;
int used;
long copied = 0; long copied = 0;
lock_sock(sk); lock_sock(sk);
while (iov_iter_count(&msg->msg_iter)) { while (iov_iter_count(&msg->msg_iter)) {
int used;
sgl = list_first_entry(&ctx->tsgl, sgl = list_first_entry(&ctx->tsgl,
struct skcipher_sg_list, list); struct skcipher_sg_list, list);
sg = sgl->sg; sg = sgl->sg;
...@@ -439,14 +439,13 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock, ...@@ -439,14 +439,13 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
while (!sg->length) while (!sg->length)
sg++; sg++;
used = ctx->used; if (!ctx->used) {
if (!used) {
err = skcipher_wait_for_data(sk, flags); err = skcipher_wait_for_data(sk, flags);
if (err) if (err)
goto unlock; goto unlock;
} }
used = min_t(unsigned long, used, iov_iter_count(&msg->msg_iter)); used = min_t(unsigned long, ctx->used, iov_iter_count(&msg->msg_iter));
used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used); used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used);
err = used; err = used;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment