Subject: possible lock problem in kern_sysctl.c?
To: None <tech-kern@netbsd.org>
From: Assar Westerlund <assar@sics.se>
List: tech-kern
Date: 01/16/2000 15:49:52
It would seem to me that if you get an error from copyout in
sysctl_doeproc() you might return with the proclist_lock locked.
A simple diff is appended below. Comments, anyone?
/assar
Index: kern_sysctl.c
===================================================================
RCS file: /cvsroot/syssrc/sys/kern/kern_sysctl.c,v
retrieving revision 1.55
diff -u -w -u -w -r1.55 kern_sysctl.c
--- kern_sysctl.c 1999/11/17 23:24:54 1.55
+++ kern_sysctl.c 2000/01/16 14:39:50
@@ -1013,11 +1013,11 @@
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 @@
*sizep = needed;
}
return (0);
+ cleanup:
+ proclist_unlock_read();
+ return (error);
}
/*