[v3] drm/i915/gvt: throw error on unhandled vfio ioctls

Submitted by Gerd Hoffmann on March 21, 2018, 2:08 p.m.

Details

Message ID 20180321140847.572-1-kraxel@redhat.com
State New
Headers show
Series "drm/i915/gvt: throw error on unhandled vfio ioctls" ( rev: 2 ) in Intel GVT devel

Not browsing as part of any series.

Commit Message

Gerd Hoffmann March 21, 2018, 2:08 p.m.
On unknown/unhandled ioctls the driver should return an error, so
userspace knows it tried to use something unsupported.

Cc: stable@vger.kernel.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
index 021f722e24..f34d7f1e6c 100644
--- a/drivers/gpu/drm/i915/gvt/kvmgt.c
+++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
@@ -1284,7 +1284,7 @@  static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 
 	}
 
-	return 0;
+	return -ENOTTY;
 }
 
 static ssize_t

Comments

On Wed, 21 Mar 2018 15:08:47 +0100
Gerd Hoffmann <kraxel@redhat.com> wrote:

> On unknown/unhandled ioctls the driver should return an error, so
> userspace knows it tried to use something unsupported.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> index 021f722e24..f34d7f1e6c 100644
> --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> @@ -1284,7 +1284,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
>  
>  	}
>  
> -	return 0;
> +	return -ENOTTY;
>  }
>  
>  static ssize_t

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>
On 2018.03.21 09:44:32 -0600, Alex Williamson wrote:
> On Wed, 21 Mar 2018 15:08:47 +0100
> Gerd Hoffmann <kraxel@redhat.com> wrote:
> 
> > On unknown/unhandled ioctls the driver should return an error, so
> > userspace knows it tried to use something unsupported.
> > 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > ---
> >  drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > index 021f722e24..f34d7f1e6c 100644
> > --- a/drivers/gpu/drm/i915/gvt/kvmgt.c
> > +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c
> > @@ -1284,7 +1284,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
> >  
> >  	}
> >  
> > -	return 0;
> > +	return -ENOTTY;
> >  }
> >  
> >  static ssize_t
> 
> Reviewed-by: Alex Williamson <alex.williamson@redhat.com>

Applied, thanks!