summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Mastro <amastro@fb.com>2025-09-08 18:58:40 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-12-07 00:12:25 +0300
commitfe372243af1f3d3b02f7d0b7e7c8ad149181df97 (patch)
treea60d9ba454a50bd0d59bfc41fac736f8b5514f99
parent872a99b666dc6874ef10d584a6652fd5cb7e93ed (diff)
downloadlinux-fe372243af1f3d3b02f7d0b7e7c8ad149181df97.tar.xz
vfio: return -ENOTTY for unsupported device feature
[ Upstream commit 16df67f2189a71a8310bcebddb87ed569e8352be ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/vfio/vfio_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
index 6e8804fe0095..e191422e99c4 100644
--- a/drivers/vfio/vfio_main.c
+++ b/drivers/vfio/vfio_main.c
@@ -1501,7 +1501,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);