On 10/25/19 3:31 PM, Pavel Begunkov wrote: > On 25/10/2019 20:30, Jens Axboe wrote: >> +static int io_grab_files(struct io_ring_ctx *ctx, struct io_kiocb *req) >> +{ >> + int ret = -EBADF; >> + >> + rcu_read_lock(); >> + spin_lock_irq(&ctx->inflight_lock); >> + /* >> + * We use the f_ops->flush() handler to ensure that we can flush >> + * out work accessing these files if the fd is closed. Check if >> + * the fd has changed since we started down this path, and disallow >> + * this operation if it has. >> + */ >> + if (fcheck(req->submit.ring_fd) == req->submit.ring_file) { > Can we get here from io_submit_sqes()? > ring_fd will be uninitialised in this case. We can't, we disallow submission of any opcode (for now just accept) from the sq thread that needs a file table. -- Jens Axboe