diff options
author | kib <kib@FreeBSD.org> | 2011-11-09 17:15:51 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-11-09 17:15:51 +0000 |
commit | 245b059405bad5f487b5b59da4e4d898e2397fe2 (patch) | |
tree | 1d0d681736cadd42702eb0ad1ed9912c4d51c96e /sys | |
parent | c1ad8114ddb61322b4858d2d7893884014d1cdd2 (diff) | |
download | FreeBSD-src-245b059405bad5f487b5b59da4e4d898e2397fe2.zip FreeBSD-src-245b059405bad5f487b5b59da4e4d898e2397fe2.tar.gz |
Lock the thread lock around block that retrieves td_wmesg. Otherwise,
procfs could see a thread with assigned td_wchan but still NULL td_wmesg.
Reported and tested by: pho
MFC after: 1 week
Diffstat (limited to 'sys')
-rw-r--r-- | sys/fs/procfs/procfs_status.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sys/fs/procfs/procfs_status.c b/sys/fs/procfs/procfs_status.c index 62651cb..4bfa06f 100644 --- a/sys/fs/procfs/procfs_status.c +++ b/sys/fs/procfs/procfs_status.c @@ -113,12 +113,14 @@ procfs_doprocstatus(PFS_FILL_ARGS) } tdfirst = FIRST_THREAD_IN_PROC(p); + thread_lock(tdfirst); if (tdfirst->td_wchan != NULL) { KASSERT(tdfirst->td_wmesg != NULL, ("wchan %p has no wmesg", tdfirst->td_wchan)); wmesg = tdfirst->td_wmesg; } else wmesg = "nochan"; + thread_unlock(tdfirst); if (p->p_flag & P_INMEM) { struct timeval start, ut, st; |