]> git.itanic.dy.fi Git - linux-stable/commitdiff
io_uring/msg_ring: check file type before putting
authorJens Axboe <axboe@kernel.dk>
Thu, 15 Sep 2022 17:44:35 +0000 (11:44 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Sep 2022 12:14:04 +0000 (14:14 +0200)
commit fc7222c3a9f56271fba02aabbfbae999042f1679 upstream.

If we're invoked with a fixed file, follow the normal rules of not
calling io_fput_file(). Fixed files are permanently registered to the
ring, and do not need putting separately.

Cc: stable@vger.kernel.org
Fixes: aa184e8671f0 ("io_uring: don't attempt to IOPOLL for MSG_RING requests")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
io_uring/io_uring.c

index 48833d0edd089262a623420e3dc2ad66fe943e76..602da2cfd57c8f1fa23fc0fcacf9393635b4aae0 100644 (file)
@@ -5061,7 +5061,8 @@ static int io_msg_ring(struct io_kiocb *req, unsigned int issue_flags)
                req_set_fail(req);
        __io_req_complete(req, issue_flags, ret, 0);
        /* put file to avoid an attempt to IOPOLL the req */
-       io_put_file(req->file);
+       if (!(req->flags & REQ_F_FIXED_FILE))
+               io_put_file(req->file);
        req->file = NULL;
        return 0;
 }