From 70aab8de7d692ed1ce21f14e5873dfaf6c0b834f Mon Sep 17 00:00:00 2001 From: assar Date: Sun, 16 Jan 2000 15:07:48 +0000 Subject: [PATCH] (sysctl_doeproc): make sure we release the proclist_lock even if copyout fails --- sys/kern/kern_sysctl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index eabbe6026230..5d43f543f74c 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sysctl.c,v 1.55 1999/11/17 23:24:54 is Exp $ */ +/* $NetBSD: kern_sysctl.c,v 1.56 2000/01/16 15:07:48 assar Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -1013,11 +1013,11 @@ again: error = copyout((caddr_t)p, &dp->kp_proc, sizeof(struct proc)); if (error) - return (error); + goto cleanup; error = copyout((caddr_t)&eproc, &dp->kp_eproc, sizeof(eproc)); if (error) - return (error); + goto cleanup; dp++; buflen -= sizeof(struct kinfo_proc); } @@ -1037,6 +1037,9 @@ again: *sizep = needed; } return (0); + cleanup: + proclist_unlock_read(); + return (error); } /*