summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2014-07-28 01:01:20 +0000
committerkib <kib@FreeBSD.org>2014-07-28 01:01:20 +0000
commit1a878ba1c0b17d23acf82ec3ec968d6895b35399 (patch)
tree4c5af4f15ae24d61e6f2209c6372d2d00f230a25 /sys/fs/tmpfs
parente0e54a97de3dedd0cc276b37878c7e6588f721bf (diff)
downloadFreeBSD-src-1a878ba1c0b17d23acf82ec3ec968d6895b35399.zip
FreeBSD-src-1a878ba1c0b17d23acf82ec3ec968d6895b35399.tar.gz
MFC r268608:
The tmpfs_link() must not dereference the filesystem-specific data for a vnode until it is verified that the vnode indeed belongs to tmpfs mount.
Diffstat (limited to 'sys/fs/tmpfs')
-rw-r--r--sys/fs/tmpfs/tmpfs_vnops.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c
index ea27fca..3586a28 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -570,8 +570,6 @@ tmpfs_link(struct vop_link_args *v)
MPASS(cnp->cn_flags & HASBUF);
MPASS(dvp != vp); /* XXX When can this be false? */
- node = VP_TO_TMPFS_NODE(vp);
-
/* XXX: Why aren't the following two tests done by the caller? */
/* Hard links of directories are forbidden. */
@@ -586,6 +584,8 @@ tmpfs_link(struct vop_link_args *v)
goto out;
}
+ node = VP_TO_TMPFS_NODE(vp);
+
/* Ensure that we do not overflow the maximum number of links imposed
* by the system. */
MPASS(node->tn_links <= LINK_MAX);
OpenPOWER on IntegriCloud