summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2026-04-20 17:06:00 +0300
committerJens Axboe <axboe@kernel.dk>2026-04-21 21:18:44 +0300
commit8e1f412b5bc690cb72b3303a1ae0d42955e5e2b3 (patch)
treec5be21c48314d5093934691c8f11b0338f71159b
parent42a702aaedf54aa8056fc429fc757a600182e5f7 (diff)
downloadlinux-8e1f412b5bc690cb72b3303a1ae0d42955e5e2b3.tar.xz
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: c5e9f6a96bf7 ("io_uring: unify getting ctx from passed in file descriptor") Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--io_uring/io_uring.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index dd6326dc5f88..4ed998d60c09 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -2575,7 +2575,8 @@ struct file *io_uring_ctx_get_file(unsigned int fd, bool registered)
return ERR_PTR(-EBADF);
if (io_is_uring_fops(file))
return file;
- fput(file);
+ if (!registered)
+ fput(file);
return ERR_PTR(-EOPNOTSUPP);
}