Skip to content

Commit

Permalink
io_uring/msg_ring: check file type before putting
Browse files Browse the repository at this point in the history
commit fc7222c 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: aa184e8 ("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>
  • Loading branch information
axboe authored and gregkh committed Sep 23, 2022
1 parent 6f5ceeb commit d50c30b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion io_uring/io_uring.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit d50c30b

Please sign in to comment.