Skip to content

Commit

Permalink
io_uring_enter(): don't leave f.flags uninitialized
Browse files Browse the repository at this point in the history
simplifies logics on cleanup, as well...

Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed May 12, 2022
1 parent 3123109 commit 4329490
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4329490

Please sign in to comment.