Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 May 2009 16:13:26 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r192644 - head/sys/kern
Message-ID:  <200905231613.n4NGDQvJ060209@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Sat May 23 16:13:26 2009
New Revision: 192644
URL: http://svn.freebsd.org/changeset/base/192644

Log:
  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)

Modified:
  head/sys/kern/kern_jail.c

Modified: head/sys/kern/kern_jail.c
==============================================================================
--- head/sys/kern/kern_jail.c	Sat May 23 16:11:36 2009	(r192643)
+++ head/sys/kern/kern_jail.c	Sat May 23 16:13:26 2009	(r192644)
@@ -1196,14 +1196,6 @@ kern_jail_get(struct thread *td, struct 
 
 	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 
 		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.
 	 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905231613.n4NGDQvJ060209>