]> git.baikalelectronics.ru Git - kernel.git/commitdiff
io_uring: fix uninitialized field in rw io_kiocb
authorJoseph Ravichandran <jravi@mit.edu>
Thu, 28 Apr 2022 16:57:52 +0000 (12:57 -0400)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Apr 2022 19:13:43 +0000 (13:13 -0600)
io_rw_init_file does not initialize kiocb->private, so when iocb_bio_iopoll
reads kiocb->private it can contain uninitialized data.

Fixes: bdfaab30ba9a ("block: switch polling to be bio based")
Signed-off-by: Joseph Ravichandran <jravi@mit.edu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c

index 92ac50f139cde8e2a2964cb71489834d42ad4fce..e3ae26ff5d1aed82a697ae577493e873fd47dbb2 100644 (file)
@@ -3783,6 +3783,7 @@ static int io_rw_init_file(struct io_kiocb *req, fmode_t mode)
                if (!(kiocb->ki_flags & IOCB_DIRECT) || !file->f_op->iopoll)
                        return -EOPNOTSUPP;
 
+               kiocb->private = NULL;
                kiocb->ki_flags |= IOCB_HIPRI | IOCB_ALLOC_CACHE;
                kiocb->ki_complete = io_complete_rw_iopoll;
                req->iopoll_completed = 0;