From owner-svn-src-all@freebsd.org Sun May 20 20:08:22 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 8D26EEEE1E9; Sun, 20 May 2018 20:08:22 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3E12D6E2BE; Sun, 20 May 2018 20:08:22 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 152EB1AF50; Sun, 20 May 2018 20:08:22 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4KK8LDY041637; Sun, 20 May 2018 20:08:21 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4KK8L0h041636; Sun, 20 May 2018 20:08:21 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <201805202008.w4KK8L0h041636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 20 May 2018 20:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r333936 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 333936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 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: Sun, 20 May 2018 20:08:22 -0000 Author: mmacy Date: Sun May 20 20:08:21 2018 New Revision: 333936 URL: https://svnweb.freebsd.org/changeset/base/333936 Log: in(s)_moptions: free before tearing down inpcb Modified: head/sys/netinet/in_pcb.c Modified: head/sys/netinet/in_pcb.c ============================================================================== --- head/sys/netinet/in_pcb.c Sun May 20 19:35:24 2018 (r333935) +++ head/sys/netinet/in_pcb.c Sun May 20 20:08:21 2018 (r333936) @@ -1341,33 +1341,16 @@ in_pcbfree_deferred(epoch_context_t ctx) { struct inpcb *inp; struct inpcbinfo *pcbinfo; -#ifdef INET6 - struct ip6_moptions *im6o = NULL; -#endif -#ifdef INET - struct ip_moptions *imo = NULL; -#endif inp = __containerof(ctx, struct inpcb, inp_epoch_ctx); pcbinfo = inp->inp_pcbinfo; INP_WLOCK(inp); -#ifdef INET - imo = inp->inp_moptions; - inp->inp_moptions = NULL; -#endif /* XXXRW: Do as much as possible here. */ #if defined(IPSEC) || defined(IPSEC_SUPPORT) if (inp->inp_sp != NULL) ipsec_delete_pcbpolicy(inp); #endif -#ifdef INET6 - if (inp->inp_vflag & INP_IPV6PROTO) { - ip6_freepcbopts(inp->in6p_outputopts); - im6o = inp->in6p_moptions; - inp->in6p_moptions = NULL; - } -#endif if (inp->inp_options) (void)m_free(inp->inp_options); @@ -1379,12 +1362,6 @@ in_pcbfree_deferred(epoch_context_t ctx) #endif if (!in_pcbrele_wlocked(inp)) INP_WUNLOCK(inp); -#ifdef INET6 - ip6_freemoptions(im6o); -#endif -#ifdef INET - inp_freemoptions(imo); -#endif } /* @@ -1399,6 +1376,12 @@ in_pcbfree_deferred(epoch_context_t ctx) void in_pcbfree(struct inpcb *inp) { +#ifdef INET6 + struct ip6_moptions *im6o = NULL; +#endif +#ifdef INET + struct ip_moptions *imo = NULL; +#endif struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); @@ -1417,6 +1400,19 @@ in_pcbfree(struct inpcb *inp) } #endif INP_WLOCK_ASSERT(inp); +#ifdef INET + imo = inp->inp_moptions; + inp->inp_moptions = NULL; + inp_freemoptions(imo); +#endif +#ifdef INET6 + if (inp->inp_vflag & INP_IPV6PROTO) { + ip6_freepcbopts(inp->in6p_outputopts); + im6o = inp->in6p_moptions; + inp->in6p_moptions = NULL; + ip6_freemoptions(im6o); + } +#endif /* Remove first from list */ INP_LIST_WLOCK(pcbinfo); inp->inp_gencnt = ++pcbinfo->ipi_gencnt;