diff mbox series

[5.10] io_uring: fix ITER_BVEC check

Message ID 26e5446cb6252589a7edc4c3bbe4d8a503919bd8.1606172908.git.asml.silence@gmail.com
State Accepted
Commit 9c3a205c5ffa36e96903c2e37eb5f41c0f03c43e
Headers show
Series [5.10] io_uring: fix ITER_BVEC check | expand

Commit Message

Pavel Begunkov Nov. 23, 2020, 11:20 p.m. UTC
iov_iter::type is a bitmask that also keeps direction etc., so it
shouldn't be directly compared against ITER_*. Use proper helper.

Cc: <stable@vger.kernel.org> # 5.9
Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jeff Moyer Nov. 24, 2020, 2:45 p.m. UTC | #1
Pavel Begunkov <asml.silence@gmail.com> writes:

> iov_iter::type is a bitmask that also keeps direction etc., so it
> shouldn't be directly compared against ITER_*. Use proper helper.
>
> Cc: <stable@vger.kernel.org> # 5.9
> Reported-by: David Howells <dhowells@redhat.com>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>

Fixes: ff6165b2d7f6 ("io_uring: retain iov_iter state over io_read/io_write calls")

> ---
>  fs/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 593dfef32b17..7c1f255807f5 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -3278,7 +3278,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
>  	rw->free_iovec = iovec;
>  	rw->bytes_done = 0;
>  	/* can only be fixed buffers, no need to do anything */
> -	if (iter->type == ITER_BVEC)
> +	if (iov_iter_is_bvec(iter))
>  		return;
>  	if (!iovec) {
>  		unsigned iov_off = 0;
diff mbox series

Patch

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 593dfef32b17..7c1f255807f5 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3278,7 +3278,7 @@  static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
 	rw->free_iovec = iovec;
 	rw->bytes_done = 0;
 	/* can only be fixed buffers, no need to do anything */
-	if (iter->type == ITER_BVEC)
+	if (iov_iter_is_bvec(iter))
 		return;
 	if (!iovec) {
 		unsigned iov_off = 0;