From owner-svn-src-stable@freebsd.org Fri Aug 25 22:44:56 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 68BE9DE3078; Fri, 25 Aug 2017 22:44:56 +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 34F8C73813; Fri, 25 Aug 2017 22:44:56 +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 v7PMit71016638; Fri, 25 Aug 2017 22:44:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7PMitD7016636; Fri, 25 Aug 2017 22:44:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201708252244.v7PMitD7016636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Fri, 25 Aug 2017 22:44:55 +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: r322908 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: stable/11/sys/fs/nfsclient X-SVN-Commit-Revision: 322908 X-SVN-Commit-Repository: base 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, 25 Aug 2017 22:44:56 -0000 Author: rmacklem Date: Fri Aug 25 22:44:55 2017 New Revision: 322908 URL: https://svnweb.freebsd.org/changeset/base/322908 Log: MFC: r321675 Fix possible crash for the NFSv4.1 pNFS client. If the nfsrpc_createlayoutrpc() call in nfsrpc_getcreatelayout() fails, the code used nfhpp when it might be set NULL. This patch checks for the error cases (laystat != 0) and avoids using nfhpp for the failure case. This would only affect NFSv4.1 mounts with the "pnfs" option. Found while testing the "umount -N" patch not yet in head. Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Aug 25 22:39:49 2017 (r322907) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Fri Aug 25 22:44:55 2017 (r322908) @@ -6633,9 +6633,14 @@ nfsrpc_getcreatelayout(vnode_t dvp, char *name, int na NFSCL_DEBUG(4, "aft nfsrpc_createlayoutrpc laystat=%d err=%d\n", laystat, error); lyp = NULL; - nfhp = *nfhpp; - laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, nfhp->nfh_len, - &stateid, retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); + if (laystat == 0) { + nfhp = *nfhpp; + laystat = nfsrpc_layoutgetres(nmp, dvp, nfhp->nfh_fh, + nfhp->nfh_len, &stateid, retonclose, NULL, &lyp, &flh, + laystat, NULL, cred, p); + } else + laystat = nfsrpc_layoutgetres(nmp, dvp, NULL, 0, &stateid, + retonclose, NULL, &lyp, &flh, laystat, NULL, cred, p); if (laystat == 0) nfscl_rellayout(lyp, 0); return (error);