diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-04-09 09:59:33 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-04-09 09:59:33 +0000 |
commit | 4a6a2e92a266618d09d9e89a4de70bc56c6e2992 (patch) | |
tree | 548695f051fa5626d1442163e9c7de85b5ec5da7 /sys | |
parent | b00efea81307bd52b99dccc7218c2fb2070b3bbc (diff) |
Do a FREF()/FRELE() dance after fd_getfile() and before calling vref(9)
in namei(9).
So we're sure the 'struct file *' won't disapear behind our back when we
go parrallel.
ok visa@, bluhm@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/vfs_lookup.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 5c498b8d09d..afdf5063ff8 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_lookup.c,v 1.65 2017/08/29 02:51:27 deraadt Exp $ */ +/* $OpenBSD: vfs_lookup.c,v 1.66 2018/04/09 09:59:32 mpi Exp $ */ /* $NetBSD: vfs_lookup.c,v 1.17 1996/02/09 19:00:59 christos Exp $ */ /* @@ -190,12 +190,15 @@ fail: pool_put(&namei_pool, cnp->cn_pnbuf); return (EBADF); } + FREF(fp); dp = (struct vnode *)fp->f_data; if (fp->f_type != DTYPE_VNODE || dp->v_type != VDIR) { + FRELE(fp, p); pool_put(&namei_pool, cnp->cn_pnbuf); return (ENOTDIR); } vref(dp); + FRELE(fp, p); } for (;;) { if (!dp->v_mount) { |