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> Log:
J>   Check that in_pcbfree() is only called once for each PCB.  If that
J>   assumption is violated, "bad things" could follow.
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>   Reviewed by:       rrs
J>   Sponsored by:      Netflix, Inc.
J>   Differential Revision:     https://reviews.freebsd.org/D14990
J> Modified:
J>   head/sys/netinet/in_pcb.c
J> Modified: head/sys/netinet/in_pcb.c
J> --- head/sys/netinet/in_pcb.c        Fri Apr  6 16:48:07 2018        
J> +++ head/sys/netinet/in_pcb.c        Fri Apr  6 16:48:11 2018        
J> @@ -1288,6 +1288,13 @@ in_pcbfree(struct inpcb *inp)
J>      KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__));
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
svn-src-all@freebsd.org mailing list
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to