From owner-svn-src-stable@freebsd.org Fri May 12 18:01:06 2017 Return-Path: Delivered-To: svn-src-stable@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 D15E4D697DB; Fri, 12 May 2017 18:01:06 +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 968F61C43; Fri, 12 May 2017 18:01:06 +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 v4CI15hp053132; Fri, 12 May 2017 18:01:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v4CI15pr053131; Fri, 12 May 2017 18:01:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201705121801.v4CI15pr053131@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 12 May 2017 18:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r318245 - stable/11/sys/opencrypto X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 May 2017 18:01:06 -0000 Author: jhb Date: Fri May 12 18:01:05 2017 New Revision: 318245 URL: https://svnweb.freebsd.org/changeset/base/318245 Log: MFC 316510: Don't leak a session and lock if a GMAC key has an invalid length. Modified: stable/11/sys/opencrypto/cryptosoft.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/opencrypto/cryptosoft.c ============================================================================== --- stable/11/sys/opencrypto/cryptosoft.c Fri May 12 17:40:34 2017 (r318244) +++ stable/11/sys/opencrypto/cryptosoft.c Fri May 12 18:01:05 2017 (r318245) @@ -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);