Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Mar 2004 21:52:57 -0500 (EST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: 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
Message-ID:  <Pine.NEB.3.96L.1040327214816.10933A-100000@fledge.watson.org>
In-Reply-To: <4066159C.7030102@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

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@fledge.watson.org      Senior Research Scientist, McAfee Research




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.NEB.3.96L.1040327214816.10933A-100000>