Skip to contentSkip to conversation

drm/i915/gvt: throw error on unhandled vfio ioctls

PATCH Superseded Gerd Hoffmann 2 participants 2 messages Mar 21, 2018

Subsystems (4)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/i915/gvt: throw error on unhandled vfio ioctls

On unknown/unhandled ioctls the driver should return an error, so userspace knows it tried to use something unsupported.

---
 drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -1
index 021f722e24..be881d53c2 100644
@@ -1284,7 +1284,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 
 	}
 
-	return 0;
+	return -EINVAL;
 }
 
 static ssize_t
Signature · 6 lines
2.9.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw
Quoted 14 lines · On Wed, 21 Mar 2018 10:08:03 +0100 Gerd Hoffmann <[email protected]> wrote:

On unknown/unhandled ioctls the driver should return an error, so userspace knows it tried to use something unsupported.

---
 drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/gvt/kvmgt.c +0 -0
index 021f722e24..be881d53c2 100644

drivers/gpu/drm/i915/gvt/kvmgt.c static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd, · line 1290

Quoted 8 lines
drivers/gpu/drm/i915/gvt/kvmgt.c +1 -1
@@ -1284,7 +1284,7 @@ static long intel_vgpu_ioctl(struct mdev_device *mdev, unsigned int cmd,
 
 	}
 
-	return 0;
+	return -EINVAL;
 }
 
 static ssize_t

Absolutely, but I'd prefer to continue the standard behavior among other vfio drivers, and adopted from elsewhere in the kernel, to use -ENOTTY for an unhandled ioctl, reserving -EINVAL as an error in options for a supported ioctl. Thanks,

Alex