io_uring: Fix corrupted user_data
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 25 Oct 2019 09:31:29 +0000 (12:31 +0300)
committerJens Axboe <axboe@kernel.dk>
Fri, 25 Oct 2019 15:01:58 +0000 (09:01 -0600)
There is a bug, where failed linked requests are returned not with
specified @user_data, but with garbage from a kernel stack.

The reason is that io_fail_links() uses req->user_data, which is
uninitialised when called from io_queue_sqe() on fail path.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 1b46c72f8975f0f870ca67b80b0da2f3c9dfa0a8..0e141d905a5b6483b5234c110a88c67849124ae2 100644 (file)
@@ -2448,6 +2448,8 @@ err:
                return;
        }
 
+       req->user_data = s->sqe->user_data;
+
        /*
         * If we already have a head request, queue this one for async
         * submittal once the head completes. If we don't have a head but