cvs commit: src/sys/netinet in_pcb.c in_pcb.h ip_divert.c tcp_syncache.c tcp_usrreq.c udp_usrreq.c src/sys/netinet6 in6_pcb.c in6_pcb.h in6_src.c udp6_output.c udp6_usrreq.c

Robert Watson rwatson at FreeBSD.org
Sat Mar 27 18:55:22 PST 2004


On Sat, 27 Mar 2004, Julian Elischer wrote:

> Pawel Jakub Dawidek wrote:
> 
> >   Log:
> >   Reduce 'td' argument to 'cred' (struct ucred) argument in those functions:
> >           - in_pcbbind(),
> >           - in_pcbbind_setup(),
> >           - in_pcbconnect(),
> >           - in_pcbconnect_setup(),
> >           - in6_pcbbind(),
> >           - in6_pcbconnect(),
> >           - in6_pcbsetport().
> >   "It should simplify/clarify things a great deal." --rwatson
> 
> do any of these store the cred pointer?  Creds need to be strictly
> refcounted. 

The credential is only used during the functions, and the reference is
owned by the calling thread for the duration of the calls.  This change
basically moves the td->td_ucred dereference to the caller, rather than
doing them in the function.  It should be no less safe than the existing
code, and since td_ucred is a thread-local reference, it should be safe
assuming curthread==td in the caller.

Robert N M Watson             FreeBSD Core Team, TrustedBSD Projects
robert at fledge.watson.org      Senior Research Scientist, McAfee Research




More information about the cvs-src mailing list