[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0ea19a52-a1cf-ae8a-82d7-f4ffb3c0286b@kernel.dk>
Date: Fri, 25 Oct 2019 15:45:33 -0600
From: Jens Axboe <axboe@...nel.dk>
To: Pavel Begunkov <asml.silence@...il.com>,
linux-block@...r.kernel.org
Cc: davem@...emloft.net, netdev@...r.kernel.org, jannh@...gle.com
Subject: Re: [PATCH 2/4] io_uring: io_uring: add support for async work
inheriting files
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
Powered by blists - more mailing lists