diff options
author | ivoras <ivoras@FreeBSD.org> | 2010-09-07 22:40:45 +0000 |
---|---|---|
committer | ivoras <ivoras@FreeBSD.org> | 2010-09-07 22:40:45 +0000 |
commit | 68038653125a8bf6d9f5341cc51a181943cca1b4 (patch) | |
tree | 754bea136371e8156d6c29924e5631da4020f6f6 /sys/fs/tmpfs/tmpfs_vnops.c | |
parent | 675ed4bcb2f7aafc4ef0c6b25aa7af2da90e0bbb (diff) | |
download | FreeBSD-src-68038653125a8bf6d9f5341cc51a181943cca1b4.zip FreeBSD-src-68038653125a8bf6d9f5341cc51a181943cca1b4.tar.gz |
Avoid "Entry can disappear before we lock fdvp" panic.
PR: 150143
Submitted by: Gleb Kurtsou <gk at FreeBSD.org>
Pretty sure it won't blow up: mckusick
MFC after: 2 weeks
Diffstat (limited to 'sys/fs/tmpfs/tmpfs_vnops.c')
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 295d2ca..d3f1ff5 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -981,10 +981,14 @@ tmpfs_rename(struct vop_rename_args *v) fnode = VP_TO_TMPFS_NODE(fvp); de = tmpfs_dir_lookup(fdnode, fnode, fcnp); - /* Avoid manipulating '.' and '..' entries. */ + /* Entry can disappear before we lock fdvp, + * also avoid manipulating '.' and '..' entries. */ if (de == NULL) { - MPASS(fvp->v_type == VDIR); - error = EINVAL; + if ((fcnp->cn_flags & ISDOTDOT) != 0 || + (fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.')) + error = EINVAL; + else + error = ENOENT; goto out_locked; } MPASS(de->td_node == fnode); |