io_uring: fix fget leak when fs don't support nowait buffered read
[platform/kernel/linux-rpi.git] / io_uring / io_uring.c
index 64e07df..7625597 100644 (file)
@@ -1777,7 +1777,7 @@ int io_req_prep_async(struct io_kiocb *req)
        const struct io_issue_def *def = &io_issue_defs[req->opcode];
 
        /* assign early for deferred execution for non-fixed file */
-       if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE))
+       if (def->needs_file && !(req->flags & REQ_F_FIXED_FILE) && !req->file)
                req->file = io_file_get_normal(req, req->cqe.fd);
        if (!cdef->prep_async)
                return 0;