]> www.infradead.org Git - users/hch/misc.git/commitdiff
vfio: return -ENOTTY for unsupported device feature
authorAlex Mastro <amastro@fb.com>
Mon, 8 Sep 2025 15:58:40 +0000 (08:58 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Fri, 19 Sep 2025 20:45:43 +0000 (14:45 -0600)
The two implementers of vfio_device_ops.device_feature,
vfio_cdx_ioctl_feature and vfio_pci_core_ioctl_feature, return
-ENOTTY in the fallthrough case when the feature is unsupported. For
consistency, the base case, vfio_ioctl_device_feature, should do the
same when device_feature == NULL, indicating an implementation has no
feature extensions.

Signed-off-by: Alex Mastro <amastro@fb.com>
Link: https://lore.kernel.org/r/20250908-vfio-enotty-v1-1-4428e1539e2e@fb.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_main.c

index 91a8eae308ea5da5263058df95e38d941ac5f376..38c8e9350a60ecae779a879f9db5daf05773ad8d 100644 (file)
@@ -1252,7 +1252,7 @@ static int vfio_ioctl_device_feature(struct vfio_device *device,
                        feature.argsz - minsz);
        default:
                if (unlikely(!device->ops->device_feature))
-                       return -EINVAL;
+                       return -ENOTTY;
                return device->ops->device_feature(device, feature.flags,
                                                   arg->data,
                                                   feature.argsz - minsz);