summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNiels Provos <provos@cvs.openbsd.org>2002-07-13 08:13:55 +0000
committerNiels Provos <provos@cvs.openbsd.org>2002-07-13 08:13:55 +0000
commit45b8079718985262460b8affa1fe8b5d209904e3 (patch)
tree2276fb4d274c21bc89c74ae5c7691becfdc932d8 /sys
parent05af3004a6b59d7b9b83383dbe1fb68306de04b6 (diff)
do not call unlock when the lock is not locked; found by millert@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/systrace.c56
1 files changed, 29 insertions, 27 deletions
diff --git a/sys/dev/systrace.c b/sys/dev/systrace.c
index 1a98a1c4ec8..e31d8d98b13 100644
--- a/sys/dev/systrace.c
+++ b/sys/dev/systrace.c
@@ -237,39 +237,12 @@ systracef_ioctl(fp, cmd, data, p)
case FIOASYNC:
return (0);
- case STRIOCATTACH:
- pid = *(pid_t *)data;
- if (!pid)
- ret = EINVAL;
- else
- ret = systrace_attach(fst, pid);
- DPRINTF(("%s: attach to %d: %d\n", __func__, pid, ret));
- goto unlock;
case STRIOCDETACH:
case STRIOCREPORT:
pid = *(pid_t *)data;
if (!pid)
ret = EINVAL;
break;
- case STRIOCRESCWD:
- if (!fst->fd_pid) {
- ret = EINVAL;
- goto unlock;
- }
- fdp = p->p_fd;
-
- /* Release cwd from other process */
- if (fdp->fd_cdir)
- vrele(fdp->fd_cdir);
- if (fdp->fd_rdir)
- vrele(fdp->fd_rdir);
- /* This restores the cwd we had before */
- fdp->fd_cdir = fst->fd_cdir;
- fdp->fd_rdir = fst->fd_rdir;
- /* Note that we are normal again */
- fst->fd_pid = 0;
- fst->fd_cdir = fst->fd_rdir = NULL;
- goto unlock;
case STRIOCANSWER:
pid = ((struct systrace_answer *)data)->stra_pid;
if (!pid)
@@ -285,6 +258,8 @@ systracef_ioctl(fp, cmd, data, p)
if (!pid)
ret = EINVAL;
break;
+ case STRIOCATTACH:
+ case STRIOCRESCWD:
case STRIOCPOLICY:
break;
case STRIOCREPLACE:
@@ -310,6 +285,14 @@ systracef_ioctl(fp, cmd, data, p)
}
switch (cmd) {
+ case STRIOCATTACH:
+ pid = *(pid_t *)data;
+ if (!pid)
+ ret = EINVAL;
+ else
+ ret = systrace_attach(fst, pid);
+ DPRINTF(("%s: attach to %d: %d\n", __func__, pid, ret));
+ break;
case STRIOCDETACH:
ret = systrace_detach(strp);
break;
@@ -328,6 +311,25 @@ systracef_ioctl(fp, cmd, data, p)
case STRIOCREPLACE:
ret = systrace_preprepl(strp, (struct systrace_replace *)data);
break;
+ case STRIOCRESCWD:
+ if (!fst->fd_pid) {
+ ret = EINVAL;
+ break;
+ }
+ fdp = p->p_fd;
+
+ /* Release cwd from other process */
+ if (fdp->fd_cdir)
+ vrele(fdp->fd_cdir);
+ if (fdp->fd_rdir)
+ vrele(fdp->fd_rdir);
+ /* This restores the cwd we had before */
+ fdp->fd_cdir = fst->fd_cdir;
+ fdp->fd_rdir = fst->fd_rdir;
+ /* Note that we are normal again */
+ fst->fd_pid = 0;
+ fst->fd_cdir = fst->fd_rdir = NULL;
+ break;
case STRIOCGETCWD:
ret = systrace_getcwd(fst, strp);
break;