svn commit: r184762 - head/sys/netgraph

Alexander Motin mav at FreeBSD.org
Sat Nov 8 06:39:56 PST 2008


Attilio Rao wrote:
> 2008/11/8, Alexander Motin <mav at freebsd.org>:
>>  @@ -262,8 +264,14 @@ ngt_rcvmsg(node_p node, item_p item, hoo
>>                 case NGM_TTY_SET_TTY:
>>                         if (sc->tp != NULL)
>>                                 return (EBUSY);
>>  -                       error = ttyhook_register(&sc->tp, td, *(int *)msg->data,
>>  +
>>  +                       p = pfind(((int *)msg->data)[0]);
>>  +                       if (p == NULL)
>>  +                               return (ESRCH);
>>  +                       td = FIRST_THREAD_IN_PROC(p);
>>  +                       error = ttyhook_register(&sc->tp, td, ((int *)msg->data)[1],
>>                             &ngt_hook, sc);
>>  +                       PROC_UNLOCK(p);
>>                         if (error != 0)
>>                                 return (error);
>>                         break;
> 
> The threads iterator in strcut proc should be proc_slock protected, so
> you need to grab/release it around FIRST_THREAD_IN_PROC().

thread_find() also asserts process locked, but then it 
traverses/dereferences/returns threads without any additional locking.

-- 
Alexander Motin


More information about the svn-src-all mailing list