Skip to content

Commit

Permalink
Revert "crypto: Fix regressions caused by iov_iter changes."
Browse files Browse the repository at this point in the history
This reverts commit 750d806.

Linus already fixed this in his tree so just use what
he did.

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Feb 12, 2015
1 parent 750d806 commit e09dcd2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 = DIV_ROUND_UP(off + n, PAGE_SIZE);
npages = PAGE_ALIGN(off + n);
if (WARN_ON(npages == 0))
return -EINVAL;

Expand Down
7 changes: 4 additions & 3 deletions crypto/algif_skcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,25 +427,26 @@ 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;

while (!sg->length)
sg++;

if (!ctx->used) {
used = ctx->used;
if (!used) {
err = skcipher_wait_for_data(sk, flags);
if (err)
goto unlock;
}

used = min_t(unsigned long, ctx->used, iov_iter_count(&msg->msg_iter));
used = min_t(unsigned long, used, iov_iter_count(&msg->msg_iter));

used = af_alg_make_sg(&ctx->rsgl, &msg->msg_iter, used);
err = used;
Expand Down

0 comments on commit e09dcd2

Please sign in to comment.