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
This commit is contained in:
Ryan Moeller 2020-09-30 16:25:50 -04:00 committed by GitHub
parent 1cb8202b1b
commit d688beb191
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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]);