]> git.baikalelectronics.ru Git - kernel.git/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)
committerJens Axboe <axboe@kernel.dk>
Thu, 15 Sep 2022 17:44:35 +0000 (11:44 -0600)
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: fe6d3c7ca8d4 ("io_uring: don't attempt to IOPOLL for MSG_RING requests")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/msg_ring.c

index 976c4ba68ee7ec07052d0a5473a487ed8a1c9822..4a7e5d030c782f1d175b69afb463b2cc52c7f814 100644 (file)
@@ -165,7 +165,8 @@ done:
                req_set_fail(req);
        io_req_set_res(req, 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 IOU_OK;
 }