Take the proctree lock before traversing the process tree.