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. MFC after: 2 weeks
This commit is contained in:
parent
a758cabb3f
commit
23e148e9a4
@ -6643,9 +6643,14 @@ nfsrpc_getcreatelayout(vnode_t dvp, char *name, int namelen, struct vattr *vap,
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user