kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Yi Liu <yi.l.liu@intel.com>
Cc: alex.williamson@redhat.com, kevin.tian@intel.com,
	joro@8bytes.org, robin.murphy@arm.com, cohuck@redhat.com,
	eric.auger@redhat.com, nicolinc@nvidia.com, kvm@vger.kernel.org,
	mjrosato@linux.ibm.com, chao.p.peng@linux.intel.com,
	yi.y.sun@linux.intel.com, peterx@redhat.com, jasowang@redhat.com,
	shameerali.kolothum.thodi@huawei.com, lulu@redhat.com,
	suravee.suthikulpanit@amd.com,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, linux-s390@vger.kernel.org,
	xudong.hao@intel.com, yan.y.zhao@intel.com,
	terrence.xu@intel.com
Subject: Re: [PATCH 6/7] vfio: Accpet device file from vfio PCI hot reset path
Date: Mon, 20 Mar 2023 16:07:35 -0300	[thread overview]
Message-ID: <ZBiu9+mVurbW0x5k@nvidia.com> (raw)
In-Reply-To: <20230316124156.12064-7-yi.l.liu@intel.com>

On Thu, Mar 16, 2023 at 05:41:55AM -0700, Yi Liu wrote:
> This extends both vfio_file_is_valid() and vfio_file_has_dev() to accept
> device file from the vfio PCI hot reset.
> 
> Signed-off-by: Yi Liu <yi.l.liu@intel.com>
> ---
>  drivers/vfio/vfio_main.c | 23 +++++++++++++++++++----
>  1 file changed, 19 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
> index fe7446805afd..ebbb6b91a498 100644
> --- a/drivers/vfio/vfio_main.c
> +++ b/drivers/vfio/vfio_main.c
> @@ -1154,13 +1154,23 @@ const struct file_operations vfio_device_fops = {
>  	.mmap		= vfio_device_fops_mmap,
>  };
>  
> +static struct vfio_device *vfio_device_from_file(struct file *file)
> +{
> +	struct vfio_device *device = file->private_data;

Isn't this a df now?

> +	if (file->f_op != &vfio_device_fops)
> +		return NULL;
> +	return device;
> +}

The device has to be bound to be a security proof.

Jason

  parent reply	other threads:[~2023-03-20 19:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-16 12:41 [PATCH 0/7] Introduce new methods for verifying ownership in vfio PCI hot reset Yi Liu
2023-03-16 12:41 ` [PATCH 1/7] vfio/pci: Update comment around group_fd get in vfio_pci_ioctl_pci_hot_reset() Yi Liu
2023-03-16 12:41 ` [PATCH 2/7] vfio/pci: Only check ownership of opened devices in hot reset Yi Liu
2023-03-20 18:54   ` Jason Gunthorpe
2023-03-16 12:41 ` [PATCH 3/7] vfio/pci: Allow passing zero-length fd array in VFIO_DEVICE_PCI_HOT_RESET Yi Liu
2023-03-17  1:15   ` Tian, Kevin
2023-03-20 19:02   ` Jason Gunthorpe
2023-03-23 10:21     ` Liu, Yi L
2023-03-23 11:33       ` Jason Gunthorpe
2023-03-16 12:41 ` [PATCH 4/7] vfio/pci: Renaming for accepting device fd in hot reset path Yi Liu
2023-03-17  1:16   ` Tian, Kevin
2023-03-20 19:05   ` Jason Gunthorpe
2023-03-16 12:41 ` [PATCH 5/7] vfio: Refine vfio file kAPIs for vfio PCI hot reset Yi Liu
2023-03-17  1:17   ` Tian, Kevin
2023-03-16 12:41 ` [PATCH 6/7] vfio: Accpet device file from vfio PCI hot reset path Yi Liu
2023-03-17  1:17   ` Tian, Kevin
2023-03-20 19:07   ` Jason Gunthorpe [this message]
2023-03-23 10:14     ` Liu, Yi L
2023-03-23 14:43       ` Jason Gunthorpe
2023-03-16 12:41 ` [PATCH 7/7] vfio/pci: Accept device fd in VFIO_DEVICE_PCI_HOT_RESET ioctl Yi Liu
2023-03-17  1:19   ` Tian, Kevin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZBiu9+mVurbW0x5k@nvidia.com \
    --to=jgg@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=chao.p.peng@linux.intel.com \
    --cc=cohuck@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jasowang@redhat.com \
    --cc=joro@8bytes.org \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=lulu@redhat.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=nicolinc@nvidia.com \
    --cc=peterx@redhat.com \
    --cc=robin.murphy@arm.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=terrence.xu@intel.com \
    --cc=xudong.hao@intel.com \
    --cc=yan.y.zhao@intel.com \
    --cc=yi.l.liu@intel.com \
    --cc=yi.y.sun@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).