Re: [PATCH] fs/io_uring: fix O_PATH fds in openat, openat2, statx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 07, 2020 at 04:25:24PM -0600, Jens Axboe wrote:

>  static int io_close(struct io_kiocb *req, bool force_nonblock)
>  {
> +	struct files_struct *files = current->files;
>  	int ret;
>  
>  	req->close.put_file = NULL;
> -	ret = __close_fd_get_file(req->close.fd, &req->close.put_file);
> +	spin_lock(&files->file_lock);
> +	if (req->file->f_op == &io_uring_fops ||
> +	    req->close.fd == req->ctx->ring_fd) {
> +		spin_unlock(&files->file_lock);
> +		return -EBADF;
> +	}
> +
> +	ret = __close_fd_get_file_locked(files, req->close.fd,
> +						&req->close.put_file);

Pointless.  By that point req->file might have nothing in common with
anything in any descriptor table.

Al, carefully _not_ saying anything about the taste and style of the
entire thing...



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux