From 8eee3a3d58f8040dfd2a8fc8d8ad5e8ec61ae296 Mon Sep 17 00:00:00 2001 From: Maxime Henrion Date: Fri, 10 May 2002 15:41:14 +0000 Subject: [PATCH] Fix several bugs in devfs_lookupx(). When we check the nameiop to make sure it's a correct operation for devfs, do it only in the ISLASTCN case. If we don't, we are assuming that the final file will be in devfs, which is not true if another partition is mounted on top of devfs or with special filenames (like /dev/net/../../foo). Reviewed by: phk --- sys/fs/devfs/devfs_vnops.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/fs/devfs/devfs_vnops.c b/sys/fs/devfs/devfs_vnops.c index 39857a968e8..3ec9fb5198a 100644 --- a/sys/fs/devfs/devfs_vnops.c +++ b/sys/fs/devfs/devfs_vnops.c @@ -276,7 +276,7 @@ devfs_lookupx(ap) *vpp = NULLVP; - if (nameiop == RENAME) + if ((flags & ISLASTCN) && nameiop == RENAME) return (EOPNOTSUPP); if (dvp->v_type != VDIR) @@ -290,7 +290,7 @@ devfs_lookupx(ap) return (error); if (cnp->cn_namelen == 1 && *pname == '.') { - if (nameiop != LOOKUP) + if ((flags & ISLASTCN) && nameiop != LOOKUP) return (EINVAL); *vpp = dvp; VREF(dvp); @@ -298,7 +298,7 @@ devfs_lookupx(ap) } if (flags & ISDOTDOT) { - if (nameiop != LOOKUP) + if ((flags & ISLASTCN) && nameiop != LOOKUP) return (EINVAL); VOP_UNLOCK(dvp, 0, td); de = TAILQ_FIRST(&dd->de_dlist); /* "." */