From c9c20fc2efec90ca9baee1e1a14935540c94c6c4 Mon Sep 17 00:00:00 2001 From: dlg Date: Tue, 12 Aug 2014 01:25:21 +0000 Subject: [PATCH] i accidentally removed the check for whether the requested pool in the sysctl path exists. return ENOENT instead of trying a NULL deref. --- sys/kern/subr_pool.c | 8 ++++++-- 1 file 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); } -- 2.20.1