crypto: Fix regressions caused by iov_iter changes.
authorAl Viro <viro@zeniv.linux.org.uk>
Wed, 11 Feb 2015 05:24:55 +0000 (21:24 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 11 Feb 2015 05:24:55 +0000 (21:24 -0800)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
crypto/af_alg.c
crypto/algif_skcipher.c

index eb78fe8a60c8e175af9b5e976510997eb87777c9..5b11d645343d6a291582123aa4b8f33ad294b55f 100644 (file)
@@ -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 = DIV_ROUND_UP(off + n, PAGE_SIZE);
        if (WARN_ON(npages == 0))
                return -EINVAL;
 
index 37110fd68adfecb84a2b78663c937f6567106da1..0eb31a69a0a6d2479c814f89998326c3c70d6eab 100644 (file)
@@ -427,11 +427,11 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
        struct skcipher_sg_list *sgl;
        struct scatterlist *sg;
        int err = -EAGAIN;
-       int used;
        long copied = 0;
 
        lock_sock(sk);
        while (iov_iter_count(&msg->msg_iter)) {
+               int used;
                sgl = list_first_entry(&ctx->tsgl,
                                       struct skcipher_sg_list, list);
                sg = sgl->sg;
@@ -439,14 +439,13 @@ static int skcipher_recvmsg(struct kiocb *unused, struct socket *sock,
                while (!sg->length)
                        sg++;
 
-               used = ctx->used;
-               if (!used) {
+               if (!ctx->used) {
                        err = skcipher_wait_for_data(sk, flags);
                        if (err)
                                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);
                err = used;