From owner-dev-commits-src-main@freebsd.org Mon Mar 8 06:25:49 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7116F566A78; Mon, 8 Mar 2021 06:25:49 +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 4Dv7d92mBLz3jKc; Mon, 8 Mar 2021 06:25:49 +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 518CA24511; Mon, 8 Mar 2021 06:25:49 +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 1286Pnm1059750; Mon, 8 Mar 2021 06:25:49 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1286PnkD059749; Mon, 8 Mar 2021 06:25:49 GMT (envelope-from git) Date: Mon, 8 Mar 2021 06:25:49 GMT Message-Id: <202103080625.1286PnkD059749@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 2b82c94acff6 - main - if_wg: avoid null ptr deref MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2b82c94acff6b4a90da5af700b59cd398481e968 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2021 06:25:49 -0000 The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=2b82c94acff6b4a90da5af700b59cd398481e968 commit 2b82c94acff6b4a90da5af700b59cd398481e968 Author: Kyle Evans AuthorDate: 2021-03-08 02:47:27 +0000 Commit: Kyle Evans CommitDate: 2021-03-08 06:25:34 +0000 if_wg: avoid null ptr deref While we're here, sync up with OpenBSD and don't use a keypair !kp_valid MFC after: 3 days --- sys/dev/if_wg/module/wg_noise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/if_wg/module/wg_noise.c b/sys/dev/if_wg/module/wg_noise.c index 0fa7664e66d5..08a0d8d32876 100644 --- a/sys/dev/if_wg/module/wg_noise.c +++ b/sys/dev/if_wg/module/wg_noise.c @@ -673,7 +673,7 @@ noise_remote_decrypt(struct noise_remote *r, struct noise_data *data, * REKEY_AFTER_TIME_RECV seconds. */ ret = ESTALE; kp = r->r_current; - if (kp->kp_is_initiator && + if (kp != NULL && kp->kp_valid && kp->kp_is_initiator && noise_timer_expired(&kp->kp_birthdate, REKEY_AFTER_TIME_RECV, 0)) goto error;