Skip to content

Commit 604a31d

Browse files
committed
FreeBSD: Prevent NULL pointer dereference of resid
spa_config_load() passes NULL into resid when doing zfs_file_read(). This would trip over when vfs.zfs.autoimport_disable=0. Sponsored by: The FreeBSD Foundation Signed-off-by: Ka Ho Ng <[email protected]> Reviewed-By: Allan Jude <[email protected]>
1 parent 71ae6a9 commit 604a31d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

module/os/freebsd/zfs/zfs_file_os.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ zfs_file_read_impl(zfs_file_t *fp, void *buf, size_t count, loff_t *offp,
158158
rc = fo_read(fp, &auio, td->td_ucred, FOF_OFFSET, td);
159159
if (rc)
160160
return (SET_ERROR(rc));
161-
*resid = auio.uio_resid;
161+
if (resid)
162+
*resid = auio.uio_resid;
162163
*offp += count - auio.uio_resid;
163164
return (SET_ERROR(0));
164165
}

0 commit comments

Comments
 (0)