From owner-svn-src-head@freebsd.org Wed Apr 5 01:46:43 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0E336D2E39E; Wed, 5 Apr 2017 01:46:43 +0000 (UTC) (envelope-from jhb@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 mx1.freebsd.org (Postfix) with ESMTPS id D4723BCB; Wed, 5 Apr 2017 01:46:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v351kgs5093118; Wed, 5 Apr 2017 01:46:42 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v351kgJZ093117; Wed, 5 Apr 2017 01:46:42 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201704050146.v351kgJZ093117@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 5 Apr 2017 01:46:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r316510 - head/sys/opencrypto X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Apr 2017 01:46:43 -0000 Author: jhb Date: Wed Apr 5 01:46:41 2017 New Revision: 316510 URL: https://svnweb.freebsd.org/changeset/base/316510 Log: Don't leak a session and lock if a GMAC key has an invalid length. Reviewed by: delphij (secteam) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D10273 Modified: head/sys/opencrypto/cryptosoft.c Modified: head/sys/opencrypto/cryptosoft.c ============================================================================== --- head/sys/opencrypto/cryptosoft.c Wed Apr 5 01:44:03 2017 (r316509) +++ head/sys/opencrypto/cryptosoft.c Wed Apr 5 01:46:41 2017 (r316510) @@ -930,8 +930,11 @@ swcr_newsession(device_t dev, u_int32_t axf = &auth_hash_nist_gmac_aes_256; auth4common: len = cri->cri_klen / 8; - if (len != 16 && len != 24 && len != 32) + if (len != 16 && len != 24 && len != 32) { + swcr_freesession_locked(dev, i); + rw_runlock(&swcr_sessions_lock); return EINVAL; + } (*swd)->sw_ictx = malloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT);