summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/vnode.c
diff options
context:
space:
mode:
authorsn199410 <none@none>2007-03-19 14:20:27 -0700
committersn199410 <none@none>2007-03-19 14:20:27 -0700
commit48011479cce51f5534141868012dcb9828a0fd63 (patch)
treeca55b26f00ff79591a49fc82391d4d87cf8833ee /usr/src/uts/common/fs/vnode.c
parentf05faa4ea8df92014407b88058ffeb988a32b6fd (diff)
downloadillumos-gate-48011479cce51f5534141868012dcb9828a0fd63.tar.gz
6296436 /usr/bin/rm has slowed down
6478856 rm(1) fails to delete subdirectories if the current directory is non-readable 6478917 recursive rm operations should be performed via file descriptors 6500134 v_path construction can consume boundless amounts of memory 6501452 *rm* rm can loop forever and delete the wrong files.
Diffstat (limited to 'usr/src/uts/common/fs/vnode.c')
-rw-r--r--usr/src/uts/common/fs/vnode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr/src/uts/common/fs/vnode.c b/usr/src/uts/common/fs/vnode.c
index 49bde7abeb..b18074e49d 100644
--- a/usr/src/uts/common/fs/vnode.c
+++ b/usr/src/uts/common/fs/vnode.c
@@ -19,7 +19,7 @@
* CDDL HEADER END
*/
/*
- * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
@@ -2511,6 +2511,9 @@ fs_new_caller_id()
* a safe manner. If the vnode already has path information embedded, then the
* cached path is left untouched.
*/
+
+size_t max_vnode_path = 4 * MAXPATHLEN;
+
void
vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp,
const char *path, size_t plen)
@@ -2553,6 +2556,10 @@ vn_setpath(vnode_t *rootvp, struct vnode *startvp, struct vnode *vp,
*/
mutex_exit(&base->v_lock);
+ /* Paths should stay within reason */
+ if (rpathalloc > max_vnode_path)
+ return;
+
rpath = kmem_alloc(rpathalloc, KM_SLEEP);
mutex_enter(&base->v_lock);