]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
af_alg_make_sg(): switch to advancing variant of iov_iter_get_pages()
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 9 Jun 2022 15:14:04 +0000 (11:14 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 9 Aug 2022 02:37:23 +0000 (22:37 -0400)
... and adjust the callers

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
crypto/af_alg.c
crypto/algif_hash.c

index c8289b7a85baaa0a83fefcfc0928ea67d522f98c..e893c0f6c8799a78f09b125702ace398ae43938d 100644 (file)
@@ -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;
 
@@ -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;
index 50f7b22f1b4825342bb1bebe13c7c26012953c58..1d017ec5c63c5260329882e2f2a4bdb557abf3a1 100644 (file)
@@ -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;