From owner-svn-src-all@freebsd.org Tue Oct 23 12:50:29 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 A8CBEFD6B30; Tue, 23 Oct 2018 12:50:29 +0000 (UTC) (envelope-from ae@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 5F89A7A45B; Tue, 23 Oct 2018 12:50:29 +0000 (UTC) (envelope-from ae@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 559F810129; Tue, 23 Oct 2018 12:50:29 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9NCoT3A005993; Tue, 23 Oct 2018 12:50:29 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9NCoTRZ005992; Tue, 23 Oct 2018 12:50:29 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201810231250.w9NCoTRZ005992@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 23 Oct 2018 12:50:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r339642 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 339642 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.29 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: Tue, 23 Oct 2018 12:50:29 -0000 Author: ae Date: Tue Oct 23 12:50:28 2018 New Revision: 339642 URL: https://svnweb.freebsd.org/changeset/base/339642 Log: Remove softc from idhash when interface is destroyed. MFC after: 20 days Modified: head/sys/net/if_ipsec.c Modified: head/sys/net/if_ipsec.c ============================================================================== --- head/sys/net/if_ipsec.c Tue Oct 23 11:34:15 2018 (r339641) +++ head/sys/net/if_ipsec.c Tue Oct 23 12:50:28 2018 (r339642) @@ -214,6 +214,12 @@ ipsec_clone_destroy(struct ifnet *ifp) sx_xlock(&ipsec_ioctl_sx); sc = ifp->if_softc; ipsec_delete_tunnel(sc); + /* + * Delete softc from idhash on interface destroy, since + * ipsec_delete_tunnel() keeps reqid unchanged. + */ + if (sc->reqid != 0) + CK_LIST_REMOVE(sc, idhash); bpfdetach(ifp); if_detach(ifp); ifp->if_softc = NULL; @@ -1025,13 +1031,11 @@ ipsec_delete_tunnel(struct ipsec_softc *sc) sc->ifp->if_drv_flags &= ~IFF_DRV_RUNNING; if (sc->family != 0) { CK_LIST_REMOVE(sc, srchash); - IPSEC_WAIT(); - + sc->family = 0; /* * Make sure that ipsec_if_input() will not do access * to softc's policies. */ - sc->family = 0; IPSEC_WAIT(); key_unregister_ifnet(sc->sp, IPSEC_SPCOUNT);