diff options
author | khng300 <[email protected]> | 2020-11-05 08:50:08 +0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-11-11 11:00:19 -0800 |
commit | ef648fec0ed3209e4c27876dc9283aef107eaff6 (patch) | |
tree | 3658738cbabc3f72e3af8b688858eeb74155422d /module | |
parent | e518548e178ed380522707219ac2d71ab7b92dbc (diff) |
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
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Signed-off-by: Ka Ho Ng <[email protected]>
Closes #11149
Diffstat (limited to 'module')
-rw-r--r-- | module/os/freebsd/zfs/zfs_file_os.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/module/os/freebsd/zfs/zfs_file_os.c b/module/os/freebsd/zfs/zfs_file_os.c index d86eeceab..8fb259f4b 100644 --- a/module/os/freebsd/zfs/zfs_file_os.c +++ b/module/os/freebsd/zfs/zfs_file_os.c @@ -158,7 +158,8 @@ zfs_file_read_impl(zfs_file_t *fp, void *buf, size_t count, loff_t *offp, rc = fo_read(fp, &auio, td->td_ucred, FOF_OFFSET, td); if (rc) return (SET_ERROR(rc)); - *resid = auio.uio_resid; + if (resid) + *resid = auio.uio_resid; *offp += count - auio.uio_resid; return (SET_ERROR(0)); } |