Skip to content

Commit adf3a9e

Browse files
committed
io_uring: don't check unrelated req->open.how in accept request
Looks like a victim of too much copy/paste, we should not be looking at req->open.how in accept. The point is to check CLOEXEC and error out, which we don't invalid direct descriptors on exec. Hence any attempt to get a direct descriptor with CLOEXEC is invalid. No harm is done here, as req->open.how.flags overlaps with req->accept.flags, but it's very confusing and might change if either of those command structs are modified. Fixes: aaa4db1 ("io_uring: accept directly into fixed file table") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent dbc7d45 commit adf3a9e

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

fs/io_uring.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5535,8 +5535,7 @@ static int io_accept_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
55355535
accept->nofile = rlimit(RLIMIT_NOFILE);
55365536

55375537
accept->file_slot = READ_ONCE(sqe->file_index);
5538-
if (accept->file_slot && ((req->open.how.flags & O_CLOEXEC) ||
5539-
(accept->flags & SOCK_CLOEXEC)))
5538+
if (accept->file_slot && (accept->flags & SOCK_CLOEXEC))
55405539
return -EINVAL;
55415540
if (accept->flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK))
55425541
return -EINVAL;

0 commit comments

Comments
 (0)