summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_jail.c
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2009-05-23 16:13:26 +0000
committerjamie <jamie@FreeBSD.org>2009-05-23 16:13:26 +0000
commite446b3e48f60014d843785a627db61914fd2bcd2 (patch)
treece0b045766f42042696c6ee3f803a023a2b71d39 /sys/kern/kern_jail.c
parentf354c73971bbeea9f1eb6863466272ada887e96a (diff)
downloadFreeBSD-src-e446b3e48f60014d843785a627db61914fd2bcd2.zip
FreeBSD-src-e446b3e48f60014d843785a627db61914fd2bcd2.tar.gz
Delay an error message until the variable it uses gets initialized.
Found with: Coverity Prevent(tm) CID: 4316 Reported by: trasz Approved by: bz (mentor)
Diffstat (limited to 'sys/kern/kern_jail.c')
-rw-r--r--sys/kern/kern_jail.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/kern_jail.c b/sys/kern/kern_jail.c
index 3bc5c10..d0cc440 100644
--- a/sys/kern/kern_jail.c
+++ b/sys/kern/kern_jail.c
@@ -1196,14 +1196,6 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags)
if (flags & ~JAIL_GET_MASK)
return (EINVAL);
- if (jailed(td->td_ucred)) {
- /*
- * Don't allow a jailed process to see any jails,
- * not even its own.
- */
- vfs_opterror(opts, "jail not found");
- return (ENOENT);
- }
/* Get the parameter list. */
error = vfs_buildopts(optuio, &opts);
@@ -1211,6 +1203,12 @@ kern_jail_get(struct thread *td, struct uio *optuio, int flags)
return (error);
errmsg_pos = vfs_getopt_pos(opts, "errmsg");
+ /* Don't allow a jailed process to see any jails, not even its own. */
+ if (jailed(td->td_ucred)) {
+ vfs_opterror(opts, "jail not found");
+ return (ENOENT);
+ }
+
/*
* Find the prison specified by one of: lastjid, jid, name.
*/
OpenPOWER on IntegriCloud