Message ID | 20220622041552.737754-39-viro@zeniv.linux.org.uk (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [01/44] 9p: handling Rerror without copy_from_iter_full() | expand |
On Wed, 2022-06-22 at 05:15 +0100, Al Viro wrote: > ... and adjust the callers > > Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> > --- > crypto/af_alg.c | 3 +-- > crypto/algif_hash.c | 5 +++-- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/crypto/af_alg.c b/crypto/af_alg.c > index c8289b7a85ba..e893c0f6c879 100644 > --- a/crypto/af_alg.c > +++ b/crypto/af_alg.c > @@ -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; > diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c > index 50f7b22f1b48..1d017ec5c63c 100644 > --- a/crypto/algif_hash.c > +++ b/crypto/algif_hash.c > @@ -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; Reviewed-by: Jeff Layton <jlayton@kernel.org>
diff --git a/crypto/af_alg.c b/crypto/af_alg.c index c8289b7a85ba..e893c0f6c879 100644 --- a/crypto/af_alg.c +++ b/crypto/af_alg.c @@ -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; diff --git a/crypto/algif_hash.c b/crypto/algif_hash.c index 50f7b22f1b48..1d017ec5c63c 100644 --- a/crypto/algif_hash.c +++ b/crypto/algif_hash.c @@ -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;
... and adjust the callers Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> --- crypto/af_alg.c | 3 +-- crypto/algif_hash.c | 5 +++-- 2 files changed, 4 insertions(+), 4 deletions(-)