diff options
author | avg <avg@FreeBSD.org> | 2017-02-21 08:57:27 +0000 |
---|---|---|
committer | avg <avg@FreeBSD.org> | 2017-02-21 08:57:27 +0000 |
commit | e4d106337e3471b7718aaf65dbbbfc77dc22b87a (patch) | |
tree | 18295a7943b2192359435b3864b8015eb9c69c53 /sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | |
parent | c63528b3d367dcf834ff1759cb43d40b21511c54 (diff) | |
download | FreeBSD-src-e4d106337e3471b7718aaf65dbbbfc77dc22b87a.zip FreeBSD-src-e4d106337e3471b7718aaf65dbbbfc77dc22b87a.tar.gz |
MFC r313686: check remaining space in zfs implementations of vptocnp
PR: 216939
Diffstat (limited to 'sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c')
-rw-r--r-- | sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c index 9eaa7d2..9ac5fc2 100644 --- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c +++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c @@ -1604,16 +1604,21 @@ zfsctl_snapshot_vptocnp(struct vop_vptocnp_args *ap) } if (sep == NULL) { mutex_exit(&sdp->sd_lock); - error = ENOENT; + error = SET_ERROR(ENOENT); } else { size_t len; len = strlen(sep->se_name); - *ap->a_buflen -= len; - bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); - mutex_exit(&sdp->sd_lock); - vref(dvp); - *ap->a_vpp = dvp; + if (*ap->a_buflen < len) { + mutex_exit(&sdp->sd_lock); + error = SET_ERROR(ENOMEM); + } else { + *ap->a_buflen -= len; + bcopy(sep->se_name, ap->a_buf + *ap->a_buflen, len); + mutex_exit(&sdp->sd_lock); + vref(dvp); + *ap->a_vpp = dvp; + } } VN_RELE(dvp); |