io_drain_req() goes before checks for REQ_F_FAIL, which protect us from submitting under-prepared request (e.g. failed in io_init_req(). Fail such drained requests as well. Fixes: a8295b982c46d ("io_uring: fix failed linkchain code logic") Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- fs/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index a531c7324ea8..8902ff5add47 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -6221,6 +6221,13 @@ static bool io_drain_req(struct io_kiocb *req) int ret; u32 seq; + if (req->flags & REQ_F_FAIL) { + /* fail all, we don't submit */ + req->flags &= ~REQ_F_HARDLINK; + io_req_complete_failed(req, req->result); + return true; + } + /* * If we need to drain a request in the middle of a link, drain the * head request and the next request/link after the current link. -- 2.33.0