aboutsummaryrefslogtreecommitdiffstats
path: root/module/os
diff options
context:
space:
mode:
authorRichard Yao <[email protected]>2022-11-04 14:06:14 -0400
committerGitHub <[email protected]>2022-11-04 11:06:14 -0700
commit993ee7a00670667f97d990aa5e38eb5cf5effc37 (patch)
tree867561c2325d96b4d3cff33866462782db06ac24 /module/os
parentf66ffe68787f9675ad7cce7644a1f81f28a86939 (diff)
FreeBSD: Fix out of bounds read in zfs_ioctl_ozfs_to_legacy()
There is an off by 1 error in the check. Fortunately, this function does not appear to be used in kernel space, despite being compiled as part of the kernel module. However, it is used in userspace. Callers of lzc_ioctl_fd() likely will crash if they attempt to use the unimplemented request number. This was reported by FreeBSD's coverity scan. Reported-by: Coverity (CID 1432059) Reviewed-by: Ryan Moeller <[email protected]> Reviewed-by: Damian Szuberski <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Richard Yao <[email protected]> Closes #14135
Diffstat (limited to 'module/os')
-rw-r--r--module/os/freebsd/zfs/zfs_ioctl_compat.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/zfs_ioctl_compat.c b/module/os/freebsd/zfs/zfs_ioctl_compat.c
index d495cc0dc..08913ab05 100644
--- a/module/os/freebsd/zfs/zfs_ioctl_compat.c
+++ b/module/os/freebsd/zfs/zfs_ioctl_compat.c
@@ -319,7 +319,7 @@ zfs_ioctl_legacy_to_ozfs(int request)
int
zfs_ioctl_ozfs_to_legacy(int request)
{
- if (request > ZFS_IOC_LAST)
+ if (request >= ZFS_IOC_LAST)
return (-1);
if (request > ZFS_IOC_PLATFORM) {