Skip to content

Commit 0de7c55

Browse files
ryaobehlendorf
authored andcommitted
Failure of userland copy should return EFAULT
Many key internal functions pass system return codes that are safe to return to userland. In the case of ddi_copyin(9F), an error passes -1 and the documentation states very clearly that drivers should pass EFAULT to userland when this happens. http://illumos.org/man/9F/ddi_copyin This does not happen in the ZFS source code. I believe it should be changed to pass EFAULT. I caught this when writing man pages for the libzfs_core API. Signed-off-by: Richard Yao <ryao@gentoo.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3575
1 parent b39c22b commit 0de7c55

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

module/zfs/zfs_ioctl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ get_nvlist(uint64_t nvl, uint64_t size, int iflag, nvlist_t **nvp)
13341334
if ((error = ddi_copyin((void *)(uintptr_t)nvl, packed, size,
13351335
iflag)) != 0) {
13361336
vmem_free(packed, size);
1337-
return (error);
1337+
return (SET_ERROR(EFAULT));
13381338
}
13391339

13401340
if ((error = nvlist_unpack(packed, size, &list, 0)) != 0) {

0 commit comments

Comments
 (0)