diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2022-05-11 20:30:20 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2022-05-12 17:07:05 -0400 |
commit | 4329490a78b66ae44a9c93e433da375284162e3d (patch) | |
tree | 5f13a12ea904dc90ea71109a40ee7458e8120c7e /fs/io_uring.c | |
parent | 3123109284176b1532874591f7c81f3837bbdc17 (diff) | |
download | linux-stable-4329490a78b66ae44a9c93e433da375284162e3d.tar.gz linux-stable-4329490a78b66ae44a9c93e433da375284162e3d.tar.bz2 linux-stable-4329490a78b66ae44a9c93e433da375284162e3d.zip |
io_uring_enter(): don't leave f.flags uninitialized
simplifies logics on cleanup, as well...
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/io_uring.c')
-rw-r--r-- | fs/io_uring.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c index a8413f006417..dc580a30723d 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -10961,14 +10961,14 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, return -EINVAL; fd = array_index_nospec(fd, IO_RINGFD_REG_MAX); f.file = tctx->registered_rings[fd]; - if (unlikely(!f.file)) - return -EBADF; + f.flags = 0; } else { f = fdget(fd); - if (unlikely(!f.file)) - return -EBADF; } + if (unlikely(!f.file)) + return -EBADF; + ret = -EOPNOTSUPP; if (unlikely(f.file->f_op != &io_uring_fops)) goto out_fput; @@ -11041,8 +11041,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit, out: percpu_ref_put(&ctx->refs); out_fput: - if (!(flags & IORING_ENTER_REGISTERED_RING)) - fdput(f); + fdput(f); return submitted ? submitted : ret; } |