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>
This commit is contained in:
Al Viro 2022-05-11 20:30:20 -04:00
Родитель 3123109284
Коммит 4329490a78
1 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -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;
}