io_uring: reference ->nsproxy for file table commands
If we don't get and assign the namespace for the async work, then certain paths just don't work properly (like /dev/stdin, /proc/mounts, etc). Anything that references the current namespace of the given task should be assigned for async work on behalf of that task. Cc: stable@vger.kernel.org # v5.5+ Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
@@ -5678,6 +5678,7 @@ static void io_req_drop_files(struct io_kiocb *req)
|
||||
spin_unlock_irqrestore(&ctx->inflight_lock, flags);
|
||||
req->flags &= ~REQ_F_INFLIGHT;
|
||||
put_files_struct(req->work.files);
|
||||
put_nsproxy(req->work.nsproxy);
|
||||
req->work.files = NULL;
|
||||
}
|
||||
|
||||
@@ -6086,6 +6087,8 @@ static int io_grab_files(struct io_kiocb *req)
|
||||
return 0;
|
||||
|
||||
req->work.files = get_files_struct(current);
|
||||
get_nsproxy(current->nsproxy);
|
||||
req->work.nsproxy = current->nsproxy;
|
||||
req->flags |= REQ_F_INFLIGHT;
|
||||
|
||||
spin_lock_irq(&ctx->inflight_lock);
|
||||
|
Reference in New Issue
Block a user