summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2014-08-12 01:25:22 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2014-08-12 01:25:22 +0000
commit71fc3352ff4f84f91b802622ed80e0e93efb77e4 (patch)
tree1447ec0db1a98270c03c3fa532757d249411669b /sys/kern
parent828dc4560bed23d79424c3c305a17aea60302ace (diff)
i accidentally removed the check for whether the requested pool in
the sysctl path exists. return ENOENT instead of trying a NULL deref.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/subr_pool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index 850d0f0b94e..e3fb051fbda 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.143 2014/08/12 01:05:46 dlg Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.144 2014/08/12 01:25:21 dlg Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -1427,7 +1427,7 @@ sysctl_dopool(int *name, u_int namelen, char *oldp, size_t *oldlenp)
{
struct kinfo_pool pi;
struct pool *pp;
- int rv;
+ int rv = ENOENT;
int s;
switch (name[0]) {
@@ -1453,6 +1453,9 @@ sysctl_dopool(int *name, u_int namelen, char *oldp, size_t *oldlenp)
break;
}
+ if (pp == NULL)
+ goto done;
+
switch (name[0]) {
case KERN_POOL_NAME:
rv = sysctl_rdstring(oldp, oldlenp, NULL, pp->pr_wchan);
@@ -1484,6 +1487,7 @@ sysctl_dopool(int *name, u_int namelen, char *oldp, size_t *oldlenp)
splx(s);
+done:
return (rv);
}