]> Git Repo - linux.git/commitdiff
io_uring_enter(): don't leave f.flags uninitialized
authorAl Viro <[email protected]>
Thu, 12 May 2022 00:30:20 +0000 (20:30 -0400)
committerAl Viro <[email protected]>
Thu, 12 May 2022 21:07:05 +0000 (17:07 -0400)
simplifies logics on cleanup, as well...

Reviewed-by: Jens Axboe <[email protected]>
Signed-off-by: Al Viro <[email protected]>
fs/io_uring.c

index a8413f0064170c5a6197ac6c5fd59e6cefd45cbf..dc580a30723d02789b54118d264d474f50ab4599 100644 (file)
@@ -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;
 }
 
This page took 0.084765 seconds and 4 git commands to generate.