• P
    io_uring: fix files cancellation · 508d0afa
    Pavel Begunkov 提交于
    stable inclusion
    from stable-5.10.16
    commit 1e7eb063a0f084cbed2cd8db39e9644642130ff0
    bugzilla: 48168
    
    --------------------------------
    
    [ Upstream commit bee749b1 ]
    
    io_uring_cancel_files()'s task check condition mistakenly got flipped.
    
    1. There can't be a request in the inflight list without
    IO_WQ_WORK_FILES, kill this check to keep the whole condition simpler.
    2. Also, don't call the function for files==NULL to not do such a check,
    all that staff is already handled well by its counter part,
    __io_uring_cancel_task_requests().
    
    With that just flip the task check.
    
    Also, it iowq-cancels all request of current task there, don't forget to
    set right ->files into struct io_task_cancel.
    
    Fixes: c1973b38bf639 ("io_uring: cancel only requests of current task")
    Reported-by: syzbot+c0d52d0b3c0c3ffb9525@syzkaller.appspotmail.com
    Signed-off-by: NPavel Begunkov <asml.silence@gmail.com>
    Signed-off-by: NJens Axboe <axboe@kernel.dk>
    Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
    508d0afa
io_uring.c 238.0 KB