Skip to content

Commit

Permalink
af_alg_make_sg(): switch to advancing variant of iov_iter_get_pages()
Browse files Browse the repository at this point in the history
... and adjust the callers

Reviewed-by: Jeff Layton <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Aug 9, 2022
1 parent 7d690c1 commit dc5801f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ int af_alg_make_sg(struct af_alg_sgl *sgl, struct iov_iter *iter, int len)
ssize_t n;
int npages, i;

n = iov_iter_get_pages(iter, sgl->pages, len, ALG_MAX_PAGES, &off);
n = iov_iter_get_pages2(iter, sgl->pages, len, ALG_MAX_PAGES, &off);
if (n < 0)
return n;

Expand Down Expand Up @@ -1191,7 +1191,6 @@ int af_alg_get_rsgl(struct sock *sk, struct msghdr *msg, int flags,
len += err;
atomic_add(err, &ctx->rcvused);
rsgl->sg_num_bytes = err;
iov_iter_advance(&msg->msg_iter, err);
}

*outlen = len;
Expand Down
5 changes: 3 additions & 2 deletions crypto/algif_hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ static int hash_sendmsg(struct socket *sock, struct msghdr *msg,
err = crypto_wait_req(crypto_ahash_update(&ctx->req),
&ctx->wait);
af_alg_free_sg(&ctx->sgl);
if (err)
if (err) {
iov_iter_revert(&msg->msg_iter, len);
goto unlock;
}

copied += len;
iov_iter_advance(&msg->msg_iter, len);
}

err = 0;
Expand Down

0 comments on commit dc5801f

Please sign in to comment.