summaryrefslogtreecommitdiff
path: root/sys/tmpfs/tmpfs_vnops.c
diff options
context:
space:
mode:
authorPatrick Wildt <patrick@cvs.openbsd.org>2021-10-24 09:59:53 +0000
committerPatrick Wildt <patrick@cvs.openbsd.org>2021-10-24 09:59:53 +0000
commit2ba2772746af9de8240d0008e646447af64fd4ab (patch)
tree01048c200f86bc08bac00bdb597d1eec61504039 /sys/tmpfs/tmpfs_vnops.c
parent0c99be0e9acd5bd6c7e90d32c74488d3972f51e1 (diff)
Prohibit renames of tmpfs mount-points to fix a panic.
From gerhard@
Diffstat (limited to 'sys/tmpfs/tmpfs_vnops.c')
-rw-r--r--sys/tmpfs/tmpfs_vnops.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c
index 690f09b1fec..fb862771dd4 100644
--- a/sys/tmpfs/tmpfs_vnops.c
+++ b/sys/tmpfs/tmpfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_vnops.c,v 1.48 2021/10/23 17:39:08 patrick Exp $ */
+/* $OpenBSD: tmpfs_vnops.c,v 1.49 2021/10/24 09:59:52 patrick Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
/*
@@ -1328,8 +1328,10 @@ tmpfs_rename(void *v)
/*
* Check for cross-device rename.
+ * Also don't allow renames of mount points.
*/
if (fvp->v_mount != tdvp->v_mount ||
+ fdvp->v_mount != fvp->v_mount ||
(tvp != NULL && (fvp->v_mount != tvp->v_mount))) {
tmpfs_rename_abort(v);
return EXDEV;