]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: fix ITER_BVEC check
authorPavel Begunkov <asml.silence@gmail.com>
Mon, 23 Nov 2020 23:20:27 +0000 (23:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Dec 2020 07:51:46 +0000 (08:51 +0100)
commit 9c3a205c5ffa36e96903c2e37eb5f41c0f03c43e upstream.

iov_iter::type is a bitmask that also keeps direction etc., so it
shouldn't be directly compared against ITER_*. Use proper helper.

Fixes: ff6165b2d7f6 ("io_uring: retain iov_iter state over io_read/io_write calls")
Reported-by: David Howells <dhowells@redhat.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Cc: <stable@vger.kernel.org> # 5.9
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/io_uring.c

index 5f40c5d6c2ddb71397d25269176d362588817d87..185c206e5683f70d590a3c250c557b0b9dfb74b8 100644 (file)
@@ -2991,7 +2991,7 @@ static void io_req_map_rw(struct io_kiocb *req, const struct iovec *iovec,
        rw->free_iovec = NULL;
        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;