diff options
author | 2014-06-15 20:22:12 +0000 | |
---|---|---|
committer | 2014-06-15 20:22:12 +0000 | |
commit | f37f30396f0fecdc6bce71cc5b6f9eb56c779e35 (patch) | |
tree | 473b9b8c092c7e3d2b603efc7ba0adb2d328ce22 /sys/dev/systrace.c | |
parent | Simplify EVP_MD_CTX_create() by just using calloc(). Also, use 0 rather (diff) | |
download | wireguard-openbsd-f37f30396f0fecdc6bce71cc5b6f9eb56c779e35.tar.xz wireguard-openbsd-f37f30396f0fecdc6bce71cc5b6f9eb56c779e35.zip |
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/systrace.c')
-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; |