From owner-svn-src-stable@freebsd.org Fri May 27 23:15:59 2016 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 7EFE3B4DF6D; Fri, 27 May 2016 23:15:59 +0000 (UTC) (envelope-from rmacklem@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 4CB0D19E1; Fri, 27 May 2016 23:15:59 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u4RNFwZ0003062; Fri, 27 May 2016 23:15:58 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u4RNFwFB003061; Fri, 27 May 2016 23:15:58 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201605272315.u4RNFwFB003061@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 27 May 2016 23:15:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r300887 - stable/9/sys/fs/nfsserver X-SVN-Group: stable-9 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.22 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, 27 May 2016 23:15:59 -0000 Author: rmacklem Date: Fri May 27 23:15:58 2016 New Revision: 300887 URL: https://svnweb.freebsd.org/changeset/base/300887 Log: MFC: r299514 Fix use-after-free in NFS4 lock test service. Trivial use-after-free where stp was freed too soon in the non-error path. To fix, simply move its release to the end of the routine. Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Fri May 27 23:03:44 2016 (r300886) +++ stable/9/sys/fs/nfsserver/nfs_nfsdserv.c Fri May 27 23:15:58 2016 (r300887) @@ -2395,8 +2395,6 @@ nfsrvd_lockt(struct nfsrv_descript *nd, if (!nd->nd_repstat) nd->nd_repstat = nfsrv_lockctrl(vp, &stp, &lop, &cf, clientid, &stateid, exp, nd, p); - if (stp) - FREE((caddr_t)stp, M_NFSDSTATE); if (nd->nd_repstat) { if (nd->nd_repstat == NFSERR_DENIED) { NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -2418,6 +2416,8 @@ nfsrvd_lockt(struct nfsrv_descript *nd, } } vput(vp); + if (stp) + FREE((caddr_t)stp, M_NFSDSTATE); NFSEXITCODE2(0, nd); return (0); nfsmout: