lkml.org 
[lkml]   [2020]   [Dec]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.10 510/717] io_uring: fix io_cqring_events()s noflush
    Date
    From: Pavel Begunkov <asml.silence@gmail.com>

    commit 59850d226e4907a6f37c1d2fe5ba97546a8691a4 upstream.

    Checking !list_empty(&ctx->cq_overflow_list) around noflush in
    io_cqring_events() is racy, because if it fails but a request overflowed
    just after that, io_cqring_overflow_flush() still will be called.

    Remove the second check, it shouldn't be a problem for performance,
    because there is cq_check_overflow bit check just above.

    Cc: <stable@vger.kernel.org> # 5.5+
    Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: Jens Axboe <axboe@kernel.dk>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

    ---
    fs/io_uring.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    --- a/fs/io_uring.c
    +++ b/fs/io_uring.c
    @@ -2242,7 +2242,7 @@ static unsigned io_cqring_events(struct
    * we wake up the task, and the next invocation will flush the
    * entries. We cannot safely to it from here.
    */
    - if (noflush && !list_empty(&ctx->cq_overflow_list))
    + if (noflush)
    return -1U;

    io_cqring_overflow_flush(ctx, false, NULL, NULL);

    \
     
     \ /
      Last update: 2020-12-28 15:47    [W:4.103 / U:0.220 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site