From owner-svn-src-all@freebsd.org Wed Apr 11 22:12:40 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D418F95ECA; Wed, 11 Apr 2018 22:12:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D95156E599; Wed, 11 Apr 2018 22:12:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id w3BLgj2h018020 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 Apr 2018 14:42:45 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w3BLgjxa018019; Wed, 11 Apr 2018 14:42:45 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 11 Apr 2018 14:42:44 -0700 From: Gleb Smirnoff To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332114 - head/sys/netinet Message-ID: <20180411214244.GD1069@FreeBSD.org> References: <201804061648.w36GmBkd046593@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804061648.w36GmBkd046593@repo.freebsd.org> User-Agent: Mutt/1.9.3 (2018-01-21) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Apr 2018 22:12:40 -0000 On Fri, Apr 06, 2018 at 04:48:11PM +0000, Jonathan T. Looney wrote: J> Author: jtl J> Date: Fri Apr 6 16:48:11 2018 J> New Revision: 332114 J> URL: https://svnweb.freebsd.org/changeset/base/332114 J> J> Log: J> Check that in_pcbfree() is only called once for each PCB. If that J> assumption is violated, "bad things" could follow. J> J> I believe such an assert would have detected some of the problems jch@ J> was chasing in PR 203175 (see r307551). We also use it in our internal J> TCP development efforts. And, in case a bug does slip through to J> released code, this change silently ignores subsequent calls to J> in_pcbfree(). J> J> Reviewed by: rrs J> Sponsored by: Netflix, Inc. J> Differential Revision: https://reviews.freebsd.org/D14990 J> J> Modified: J> head/sys/netinet/in_pcb.c J> J> Modified: head/sys/netinet/in_pcb.c J> ============================================================================== J> --- head/sys/netinet/in_pcb.c Fri Apr 6 16:48:07 2018 (r332113) J> +++ head/sys/netinet/in_pcb.c Fri Apr 6 16:48:11 2018 (r332114) J> @@ -1288,6 +1288,13 @@ in_pcbfree(struct inpcb *inp) J> J> KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); J> J> + KASSERT((inp->inp_flags2 & INP_FREED) == 0, J> + ("%s: called twice for pcb %p", __func__, inp)); J> + if (inp->inp_flags2 & INP_FREED) { J> + INP_WUNLOCK(inp); J> + return; J> + } J> + This code will create Coverity report. IMHO, only KASSERT should be left. -- Gleb Smirnoff