From nobody Fri Dec 03 23:34:19 2021 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id CF90618BAB34; Fri, 3 Dec 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4J5TgH3kL0z4b9h; Fri, 3 Dec 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F7C319C36; Fri, 3 Dec 2021 23:34:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1B3NYJ93078654; Fri, 3 Dec 2021 23:34:19 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1B3NYJRC078653; Fri, 3 Dec 2021 23:34:19 GMT (envelope-from git) Date: Fri, 3 Dec 2021 23:34:19 GMT Message-Id: <202112032334.1B3NYJRC078653@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: fc21aafe5ff2 - main - ipsec: fix a panic with INVARIANTS List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc21aafe5ff2e02124ad004ee1c7e28b1ea5486a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1638574459; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=QCXZsCAvdE1zJEe4X1FBM1pURhK/9r70ecJcV0y5pEo=; b=N4e/Mih/wYbfKsFZtr5iLjRsEAJptZxUloe31h9L6ABn2L79LXxYzXKhPLIpkbLUSXrUVW g5QLOoGekGgPrY/6zrMgiKV8kqvbzTN2OukywDdMz5KNYhk9ujWckceTfZKKkSXUTwwUOQ 42WBo/UOI3CFt+kSvxHtAiGqDVjUAQ5k8TQM/5zAVO6Cvfg5IiIbYS3BqcYcfFPnvJVRMT szfznOieySPxXtxiQkOFy2vfBKYI2J9d/TOEmYqo4MmYlEc48qRzylzsZa84LIQXEmW3/9 gTg93q+QTgjdvbsK2sY2UBhINcQXhHoeSUZrx22wmCJjkKTdUvCJeLWdVV0Yeg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1638574459; a=rsa-sha256; cv=none; b=rfW22kyWdnPE5e8D0XupQ7RA3bfRsJKniIFGkuxqY1mTCHrSI9VOE9xEf3lWBAyXlEJNtt XhrqS9hnCxwrts6T4Lwyl/J9z57fH8DZJpNm/hLwpwsUt8k8b66oztbb75+FCGA2kjjzEC pWGxSqXZ7gcL5D1tOk4tAhITBn5jaLDBJN9l9Fmr6mGaL6ZJgFoniDuXEvTkyk2B8xgpqW hDog9ZG99pF2ByLHwHesP8hG+l3NVSIBCYNOBhxzx3lioHblnmGfCkFQf7hl4c4iirbGBI aOr5JMVNexrmT6eI9FdU3M0bF2dQgsLHXAo3O8Ejhth7FAvcgrTqnqKKIiiPmg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=fc21aafe5ff2e02124ad004ee1c7e28b1ea5486a commit fc21aafe5ff2e02124ad004ee1c7e28b1ea5486a Author: Robert Wing AuthorDate: 2021-12-03 23:22:23 +0000 Commit: Robert Wing CommitDate: 2021-12-03 23:22:23 +0000 ipsec: fix a panic with INVARIANTS When adding an SPD entry that already exists, a refcount wraparound panic is encountered. This was caused from dropping a reference on the wrong security policy. Fixes: 4920e38fecc3 ("ipsec: fix race condition in key.c") Reviewed by: wma Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D33100 --- sys/netipsec/key.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c index cd2f8a4ccafa..4eb4c7c76464 100644 --- a/sys/netipsec/key.c +++ b/sys/netipsec/key.c @@ -2039,7 +2039,7 @@ key_spdadd(struct socket *so, struct mbuf *m, const struct sadb_msghdr *mhp) __func__, oldsp)); KEYDBG(KEY_DATA, kdebug_secpolicy(oldsp)); } else { - key_freesp(&newsp); + key_freesp(&oldsp); ipseclog((LOG_DEBUG, "%s: a SP entry exists already.\n", __func__)); return (key_senderror(so, m, EEXIST));