PERFORCE change 103221 for review
John Birrell
jb at FreeBSD.org
Sat Aug 5 03:14:54 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=103221
Change 103221 by jb at jb_freebsd2 on 2006/08/05 03:14:16
Sync to current.
(Not sure why the IFCs didn't pick these changes up.)
Affected files ...
.. //depot/projects/dtrace/src/sys/kern/kern_sysctl.c#4 edit
Differences ...
==== //depot/projects/dtrace/src/sys/kern/kern_sysctl.c#4 (text+ko) ====
@@ -1225,25 +1225,19 @@
if (error)
return (error);
- if ((oid->oid_kind & CTLFLAG_MPSAFE) == 0)
- mtx_lock(&Giant);
if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
/*
* You can't call a sysctl when it's a node, but has
* no handler. Inform the user that it's a node.
* The indx may or may not be the same as namelen.
*/
- if (oid->oid_handler == NULL) {
- error = EISDIR;
- goto done;
- }
+ if (oid->oid_handler == NULL)
+ return (EISDIR);
}
/* Is this sysctl writable? */
- if (req->newptr && !(oid->oid_kind & CTLFLAG_WR)) {
- error = EPERM;
- goto done;
- }
+ if (req->newptr && !(oid->oid_kind & CTLFLAG_WR))
+ return (EPERM);
KASSERT(req->td != NULL, ("sysctl_root(): req->td == NULL"));
@@ -1252,7 +1246,7 @@
lvl = (oid->oid_kind & CTLMASK_SECURE) >> CTLSHIFT_SECURE;
error = securelevel_gt(req->td->td_ucred, lvl);
if (error)
- goto done;
+ return (error);
}
/* Is this sysctl writable by only privileged users? */
@@ -1265,13 +1259,11 @@
flags = 0;
error = suser_cred(req->td->td_ucred, flags);
if (error)
- goto done;
+ return (error);
}
- if (!oid->oid_handler) {
- error = EINVAL;
- goto done;
- }
+ if (!oid->oid_handler)
+ return (EINVAL);
if ((oid->oid_kind & CTLTYPE) == CTLTYPE_NODE) {
arg1 = (int *)arg1 + indx;
@@ -1284,12 +1276,10 @@
error = mac_check_system_sysctl(req->td->td_ucred, oid, arg1, arg2,
req);
if (error != 0)
- goto done;
+ return (error);
#endif
error = oid->oid_handler(oid, arg1, arg2, req);
-done:
- if ((oid->oid_kind & CTLFLAG_MPSAFE) == 0)
- mtx_unlock(&Giant);
+
return (error);
}
@@ -1320,6 +1310,8 @@
if (error)
return (error);
+ mtx_lock(&Giant);
+
error = userland_sysctl(td, name, uap->namelen,
uap->old, uap->oldlenp, 0,
uap->new, uap->newlen, &j, 0);
@@ -1331,6 +1323,7 @@
error = i;
}
done2:
+ mtx_unlock(&Giant);
return (error);
}
More information about the p4-projects
mailing list