Skip to content

Commit 4329490

Browse files
author
Al Viro
committed
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>
1 parent 3123109 commit 4329490

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

fs/io_uring.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10961,14 +10961,14 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
1096110961
return -EINVAL;
1096210962
fd = array_index_nospec(fd, IO_RINGFD_REG_MAX);
1096310963
f.file = tctx->registered_rings[fd];
10964-
if (unlikely(!f.file))
10965-
return -EBADF;
10964+
f.flags = 0;
1096610965
} else {
1096710966
f = fdget(fd);
10968-
if (unlikely(!f.file))
10969-
return -EBADF;
1097010967
}
1097110968

10969+
if (unlikely(!f.file))
10970+
return -EBADF;
10971+
1097210972
ret = -EOPNOTSUPP;
1097310973
if (unlikely(f.file->f_op != &io_uring_fops))
1097410974
goto out_fput;
@@ -11041,8 +11041,7 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
1104111041
out:
1104211042
percpu_ref_put(&ctx->refs);
1104311043
out_fput:
11044-
if (!(flags & IORING_ENTER_REGISTERED_RING))
11045-
fdput(f);
11044+
fdput(f);
1104611045
return submitted ? submitted : ret;
1104711046
}
1104811047

0 commit comments

Comments
 (0)