Skip to content

Commit

Permalink
FreeBSD: Fix legacy compat for platform IOCs
Browse files Browse the repository at this point in the history
The request number is out of bounds of the platform table.

Subtract the starting offset to get the correct subscript.

Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes openzfs#10994
  • Loading branch information
Ryan Moeller authored and jsai20 committed Mar 30, 2021
1 parent e6a356e commit 45fb507
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion module/os/freebsd/zfs/zfs_ioctl_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 45fb507

Please sign in to comment.