Date: Sat, 5 Aug 2006 03:14:53 GMT From: John Birrell <jb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 103221 for review Message-ID: <200608050314.k753ErMm095355@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103221 Change 103221 by jb@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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608050314.k753ErMm095355>