svn commit: r229021 - stable/9/sys/fs/procfs

Konstantin Belousov kib at FreeBSD.org
Fri Dec 30 20:21:54 UTC 2011


Author: kib
Date: Fri Dec 30 20:21:53 2011
New Revision: 229021
URL: http://svn.freebsd.org/changeset/base/229021

Log:
  MFC r227393:
  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.

Modified:
  stable/9/sys/fs/procfs/procfs_status.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/fs/procfs/procfs_status.c
==============================================================================
--- stable/9/sys/fs/procfs/procfs_status.c	Fri Dec 30 20:12:50 2011	(r229020)
+++ stable/9/sys/fs/procfs/procfs_status.c	Fri Dec 30 20:21:53 2011	(r229021)
@@ -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;


More information about the svn-src-stable-9 mailing list