Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Aug 2017 22:44:55 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
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
Message-ID:  <201708252244.v7PMitD7016636@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708252244.v7PMitD7016636>