summaryrefslogtreecommitdiff
path: root/usr.sbin/pstat
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2020-09-28 15:53:14 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2020-09-28 15:53:14 +0000
commit17c92653b6c4c25677f842d979cb661d81dfc091 (patch)
tree10dc646100960e62f266108777c0ac5617b12964 /usr.sbin/pstat
parent33b5a429ab073b1f7380c577dd0a4bf0db82d6c8 (diff)
Fix segfault in pstat -v
Broken in r1.122 when the vnode list at the mount point was converted to a TAILQ to make softdeps happy. There was a for loop that looked a lot like a LIST_FOREACH that was converted to a TAILQ_FOREACH. Unfortunately, the loop is a bit more intricate. Revert to the original loop logic, but now with TAILQ. "looks correct" millert, "looks good" deraadt
Diffstat (limited to 'usr.sbin/pstat')
-rw-r--r--usr.sbin/pstat/pstat.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index e912817aaf6..04c9e6bcfe5 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.122 2020/01/10 10:33:35 bluhm Exp $ */
+/* $OpenBSD: pstat.c,v 1.123 2020/09/28 15:53:13 tb Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -855,7 +855,8 @@ kinfo_vnodes(void)
for (mp = TAILQ_FIRST(&kvm_mountlist); mp != NULL;
mp = TAILQ_NEXT(&mount, mnt_list)) {
KGETRET(mp, &mount, sizeof(mount), "mount entry");
- TAILQ_FOREACH(vp, &mount.mnt_vnodelist, v_mntvnodes) {
+ for (vp = TAILQ_FIRST(&mount.mnt_vnodelist);
+ vp != NULL; vp = TAILQ_NEXT(&vnode, v_mntvnodes)) {
KGETRET(vp, &vnode, sizeof(vnode), "vnode");
if ((bp + sizeof(struct vnode *) +
sizeof(struct vnode)) > evbuf)