From d688beb19110b21cbfd3e3053833b9d4ec6a277c Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 30 Sep 2020 16:25:50 -0400 Subject: [PATCH] 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 Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10994 --- module/os/freebsd/zfs/zfs_ioctl_compat.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/module/os/freebsd/zfs/zfs_ioctl_compat.c b/module/os/freebsd/zfs/zfs_ioctl_compat.c index 8dec8644c0..81967bed73 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]);