diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2017-05-07 21:32:55 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2017-05-07 21:32:55 +0000 |
commit | ff42333b84a0f438344e986850ec9fcf9ed12c5c (patch) | |
tree | 630ab18f0013044d2e7b51683ac8b4ad215bfe66 /sys/fs | |
parent | 4d358b4371becced51acf445d5b9ca3085e15ec9 (diff) | |
download | FreeBSD-src-ff42333b84a0f438344e986850ec9fcf9ed12c5c.zip FreeBSD-src-ff42333b84a0f438344e986850ec9fcf9ed12c5c.tar.gz |
MFC: r317272
Add checks for failed operations to the NFSv4 client function nfscl_mtofh().
The nfscl_mtofh() function didn't check for failed operations and, as such,
would have returned EBADRPC for these cases, due to parsing failure.
This patch adds checks, so that it returns with ND_NOMOREDATA set.
This is needed for future use in the pNFS server and acts as a safety
belt in the meantime.
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/nfsclient/nfs_clcomsubs.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/sys/fs/nfsclient/nfs_clcomsubs.c b/sys/fs/nfsclient/nfs_clcomsubs.c index 2e53fa0..a05eb32 100644 --- a/sys/fs/nfsclient/nfs_clcomsubs.c +++ b/sys/fs/nfsclient/nfs_clcomsubs.c @@ -471,6 +471,11 @@ nfscl_mtofh(struct nfsrv_descript *nd, struct nfsfh **nfhpp, flag = fxdr_unsigned(int, *tl); } else if (nd->nd_flag & ND_NFSV4) { NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + /* If the GetFH failed, clear flag. */ + if (*++tl != 0) { + nd->nd_flag |= ND_NOMOREDATA; + flag = 0; + } } if (flag) { error = nfsm_getfh(nd, nfhpp); @@ -481,8 +486,12 @@ nfscl_mtofh(struct nfsrv_descript *nd, struct nfsfh **nfhpp, /* * Now, get the attributes. */ - if (nd->nd_flag & ND_NFSV4) { + if (flag != 0 && (nd->nd_flag & ND_NFSV4) != 0) { NFSM_DISSECT(tl, u_int32_t *, 2 * NFSX_UNSIGNED); + if (*++tl != 0) { + nd->nd_flag |= ND_NOMOREDATA; + flag = 0; + } } else if (nd->nd_flag & ND_NFSV3) { NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED); if (flag) { |