aboutsummaryrefslogtreecommitdiff
path: root/module/os/freebsd/zfs/zfs_ioctl_compat.c
diff options
context:
space:
mode:
authorRyan Moeller <ryan@iXsystems.com>2020-09-30 20:25:50 +0000
committerGitHub <noreply@github.com>2020-09-30 20:25:50 +0000
commitd688beb19110b21cbfd3e3053833b9d4ec6a277c (patch)
tree078ab3a570f12486f38c3aa976dd1ee242f7c22e /module/os/freebsd/zfs/zfs_ioctl_compat.c
parent1cb8202b1b0b5810ab9eaecd19fc84f8ffb874d9 (diff)
downloadsrc-d688beb19110b21cbfd3e3053833b9d4ec6a277c.tar.gz
src-d688beb19110b21cbfd3e3053833b9d4ec6a277c.zip
FreeBSD: Fix legacy compat for platform IOCs
The request number is out of bounds of the platform table. Subtract the starting offset to get the correct subscript. Reviewed-by: Alexander Motin <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10994
Diffstat (limited to 'module/os/freebsd/zfs/zfs_ioctl_compat.c')
-rw-r--r--module/os/freebsd/zfs/zfs_ioctl_compat.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/zfs_ioctl_compat.c b/module/os/freebsd/zfs/zfs_ioctl_compat.c
index 8dec8644c06e..81967bed73f9 100644
--- a/module/os/freebsd/zfs/zfs_ioctl_compat.c
+++ b/module/os/freebsd/zfs/zfs_ioctl_compat.c
@@ -322,8 +322,10 @@ zfs_ioctl_ozfs_to_legacy(int request)
if (request > ZFS_IOC_LAST)
return (-1);
- if (request > ZFS_IOC_PLATFORM)
+ if (request > ZFS_IOC_PLATFORM) {
+ request -= ZFS_IOC_PLATFORM + 1;
return (zfs_ioctl_ozfs_to_legacy_platform_[request]);
+ }
if (request >= sizeof (zfs_ioctl_ozfs_to_legacy_common_)/sizeof (long))
return (-1);
return (zfs_ioctl_ozfs_to_legacy_common_[request]);