diff options
author | Mateusz Guzik <mjg@FreeBSD.org> | 2023-04-20 08:36:53 +0000 |
---|---|---|
committer | Mateusz Guzik <mjg@FreeBSD.org> | 2023-04-20 08:38:28 +0000 |
commit | 9c4e270822a3592bf122f9a8e4e815b4602329f1 (patch) | |
tree | 7844816120334a71847382c5de227e7b9de289d2 | |
parent | 7ff314380919d5b7c4b45e68fd093a51a998f845 (diff) | |
download | src-9c4e270822a3592bf122f9a8e4e815b4602329f1.tar.gz src-9c4e270822a3592bf122f9a8e4e815b4602329f1.zip |
zfs: fix up EINVAL from getdirentries on .zfs
PR: 270909
-rw-r--r-- | sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c index 8ba5e0b242a2..420d887b661e 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c @@ -679,6 +679,17 @@ zfsctl_root_readdir(struct vop_readdir_args *ap) ASSERT3S(vp->v_type, ==, VDIR); + /* + * FIXME: this routine only ever emits 3 entries and does not tolerate + * being called with a buffer too small to handle all of them. + * + * The check below facilitates the idiom of repeating calls until the + * count to return is 0. + */ + if (zfs_uio_offset(&uio) == 3 * sizeof(entry)) { + return (0); + } + error = sfs_readdir_common(zfsvfs->z_root, ZFSCTL_INO_ROOT, ap, &uio, &dots_offset); if (error != 0) { |