Skip to content

Commit 8e1f412

Browse files
committed
io_uring: fix spurious fput in registered ring path
Fix an issue with io_uring_ctx_get_file() not gating fput() on whether or not the file descriptor is a registered/direct one or not. Fixes: c5e9f6a ("io_uring: unify getting ctx from passed in file descriptor") Reviewed-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 42a702a commit 8e1f412

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

io_uring/io_uring.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2575,7 +2575,8 @@ struct file *io_uring_ctx_get_file(unsigned int fd, bool registered)
25752575
return ERR_PTR(-EBADF);
25762576
if (io_is_uring_fops(file))
25772577
return file;
2578-
fput(file);
2578+
if (!registered)
2579+
fput(file);
25792580
return ERR_PTR(-EOPNOTSUPP);
25802581
}
25812582

0 commit comments

Comments
 (0)