svn commit: r304218 - head/sys/netinet

Hans Petter Selasky hps at selasky.org
Tue Aug 16 12:54:18 UTC 2016


On 08/16/16 14:40, Randall Stewart wrote:
> +int
> +tcp_inpinfo_lock_add(struct inpcb *inp)
> +{
> +	in_pcbref(inp);
> +	INP_WUNLOCK(inp);
> +	INP_INFO_RLOCK(&V_tcbinfo);
> +	INP_WLOCK(inp);
> +	if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) {
> +		return(1);
> +	}
> +	return(0);
> +
> +}

Hi,

Could you add some comments describing how it is considered safe to drop 
the INP write-lock and then pick it up again?

My first impression is that because you are dropping the inp lock, 
multiple threads can enter the code in question, leaving the window open 
to races?

--HPS


More information about the svn-src-head mailing list