io_uring/msg_ring: check file type before putting

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: aa184e8671 ("io_uring: don't attempt to IOPOLL for MSG_RING requests")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Jens Axboe 2022-09-15 11:44:35 -06:00
parent 62bb0647b1
commit fc7222c3a9

View File

@ -165,7 +165,8 @@ done:
req_set_fail(req); req_set_fail(req);
io_req_set_res(req, ret, 0); io_req_set_res(req, ret, 0);
/* put file to avoid an attempt to IOPOLL the req */ /* 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; req->file = NULL;
return IOU_OK; return IOU_OK;
} }