mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-18 02:20:59 +03:00
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 <behlendorf1@llnl.gov> Reviewed-by: Allan Jude <allan@klarasystems.com> Signed-off-by: Ka Ho Ng <khng@freebsdfoundation.org> Closes #11149
This commit is contained in:
parent
e518548e17
commit
ef648fec0e
@ -158,6 +158,7 @@ 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);
|
rc = fo_read(fp, &auio, td->td_ucred, FOF_OFFSET, td);
|
||||||
if (rc)
|
if (rc)
|
||||||
return (SET_ERROR(rc));
|
return (SET_ERROR(rc));
|
||||||
|
if (resid)
|
||||||
*resid = auio.uio_resid;
|
*resid = auio.uio_resid;
|
||||||
*offp += count - auio.uio_resid;
|
*offp += count - auio.uio_resid;
|
||||||
return (SET_ERROR(0));
|
return (SET_ERROR(0));
|
||||||
|
Loading…
Reference in New Issue
Block a user