diff options
author | Matthew Dempsky <matthew@cvs.openbsd.org> | 2014-06-15 20:22:13 +0000 |
---|---|---|
committer | Matthew Dempsky <matthew@cvs.openbsd.org> | 2014-06-15 20:22:13 +0000 |
commit | a922a82345fa0ed6bc11bcfd99e2d4d0b380eef8 (patch) | |
tree | e14046b664c6d99e5bfea6a4dcb65f56822c73b4 /sys/dev | |
parent | 9b1b3bd2db8731b288d8ca2c903df3e60216c2aa (diff) |
Fix vnode leak in systrace(4).
If a user calls STRIOCGETCWD two or more times in a row without an
intervening STRIOCRESCWD, then the references held on fst->fd_{c,r}dir
would leak.
ok miod
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/systrace.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c index 122a885155e..a61caabe9b1 100644 --- a/sys/dev/systrace.c +++ b/sys/dev/systrace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: systrace.c,v 1.67 2014/04/18 11:51:17 guenther Exp $ */ +/* $OpenBSD: systrace.c,v 1.68 2014/06/15 20:22:12 matthew Exp $ */ /* * Copyright 2002 Niels Provos <provos@citi.umich.edu> * All rights reserved. @@ -1101,6 +1101,12 @@ systrace_getcwd(struct fsystrace *fst, struct str_process *strp, int atfd) return (EINVAL); } + /* Release any saved vnodes. */ + if (fst->fd_cdir != NULL) + vrele(fst->fd_cdir); + if (fst->fd_rdir != NULL) + vrele(fst->fd_rdir); + /* Store our current values */ fst->fd_pid = strp->pid; fst->fd_cdir = myfdp->fd_cdir; |