summaryrefslogtreecommitdiffstats
path: root/sys/i386/ibcs2
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2008-12-29 12:58:45 +0000
committered <ed@FreeBSD.org>2008-12-29 12:58:45 +0000
commitf3a9a195cb5b2d1f5e0a7779c33cce89b9539695 (patch)
tree1cc7c4d342853f5d46fa8f554e48601c75ec4157 /sys/i386/ibcs2
parentbd5d614be80b38952e55e5516853af28f99d108d (diff)
downloadFreeBSD-src-f3a9a195cb5b2d1f5e0a7779c33cce89b9539695.zip
FreeBSD-src-f3a9a195cb5b2d1f5e0a7779c33cce89b9539695.tar.gz
Push down Giant inside sysctl. Also add some more assertions to the code.
In the existing code we didn't really enforce that callers hold Giant before calling userland_sysctl(), even though there is no guarantee it is safe. Fix this by just placing Giant locks around the call to the oid handler. This also means we only pick up Giant for a very short period of time. Maybe we should add MPSAFE flags to sysctl or phase it out all together. I've also added SYSCTL_LOCK_ASSERT(). We have to make sure sysctl_root() and name2oid() are called with the sysctl lock held. Reviewed by: Jille Timmermans <jille quis cx>
Diffstat (limited to 'sys/i386/ibcs2')
-rw-r--r--sys/i386/ibcs2/ibcs2_sysi86.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/sys/i386/ibcs2/ibcs2_sysi86.c b/sys/i386/ibcs2/ibcs2_sysi86.c
index 4d76218..12d5c4a 100644
--- a/sys/i386/ibcs2/ibcs2_sysi86.c
+++ b/sys/i386/ibcs2/ibcs2_sysi86.c
@@ -74,15 +74,11 @@ ibcs2_sysi86(struct thread *td, struct ibcs2_sysi86_args *args)
case SETNAME: { /* set hostname given string w/ len <= 7 chars */
int name[2];
- int error;
name[0] = CTL_KERN;
name[1] = KERN_HOSTNAME;
- mtx_lock(&Giant);
- error = userland_sysctl(td, name, 2, 0, 0, 0,
- args->arg, 7, 0, 0);
- mtx_unlock(&Giant);
- return (error);
+ return (userland_sysctl(td, name, 2, 0, 0, 0,
+ args->arg, 7, 0, 0));
}
case SI86_MEM: /* size of physical memory */
OpenPOWER on IntegriCloud