summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs/tmpfs_vfsops.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2013-08-23 22:52:20 +0000
committerdelphij <delphij@FreeBSD.org>2013-08-23 22:52:20 +0000
commitb93cf732047c8ac0128b11fd4cc88d223c23f0b7 (patch)
tree797aa361030bae714654b6e39d8760ffacce6efb /sys/fs/tmpfs/tmpfs_vfsops.c
parentcf73bc83b843229737a78ef19ec7f10c25ac83bf (diff)
downloadFreeBSD-src-b93cf732047c8ac0128b11fd4cc88d223c23f0b7.zip
FreeBSD-src-b93cf732047c8ac0128b11fd4cc88d223c23f0b7.tar.gz
Allow tmpfs be mounted inside jail.
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_vfsops.c')
-rw-r--r--sys/fs/tmpfs/tmpfs_vfsops.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vfsops.c b/sys/fs/tmpfs/tmpfs_vfsops.c
index 4d55f51..57b9902 100644
--- a/sys/fs/tmpfs/tmpfs_vfsops.c
+++ b/sys/fs/tmpfs/tmpfs_vfsops.c
@@ -47,6 +47,8 @@ __FBSDID("$FreeBSD$");
#include <sys/limits.h>
#include <sys/lock.h>
#include <sys/mutex.h>
+#include <sys/proc.h>
+#include <sys/jail.h>
#include <sys/kernel.h>
#include <sys/stat.h>
#include <sys/systm.h>
@@ -138,6 +140,7 @@ tmpfs_mount(struct mount *mp)
sizeof(struct tmpfs_dirent) + sizeof(struct tmpfs_node));
struct tmpfs_mount *tmp;
struct tmpfs_node *root;
+ struct thread *td = curthread;
int error;
/* Size counters. */
u_quad_t pages;
@@ -150,6 +153,9 @@ tmpfs_mount(struct mount *mp)
struct vattr va;
+ if (!prison_allow(td->td_ucred, PR_ALLOW_MOUNT_TMPFS))
+ return (EPERM);
+
if (vfs_filteropt(mp->mnt_optnew, tmpfs_opts))
return (EINVAL);
@@ -420,4 +426,4 @@ struct vfsops tmpfs_vfsops = {
.vfs_statfs = tmpfs_statfs,
.vfs_fhtovp = tmpfs_fhtovp,
};
-VFS_SET(tmpfs_vfsops, tmpfs, 0);
+VFS_SET(tmpfs_vfsops, tmpfs, VFCF_JAIL);
OpenPOWER on IntegriCloud