From owner-svn-src-head@freebsd.org Tue Aug 16 12:54:18 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C64C8BBB951; Tue, 16 Aug 2016 12:54:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 916581A4C; Tue, 16 Aug 2016 12:54:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 83A781FE022; Tue, 16 Aug 2016 14:54:16 +0200 (CEST) Subject: Re: svn commit: r304218 - head/sys/netinet To: Randall Stewart , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201608161240.u7GCeuWS082118@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <92a3cfc1-56bc-813f-dd12-ac19c66fd716@selasky.org> Date: Tue, 16 Aug 2016 14:58:45 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: <201608161240.u7GCeuWS082118@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2016 12:54:18 -0000 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