summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorFred Isaman <iisaman@netapp.com>2011-01-06 12:36:27 +0100
committerTrond Myklebust <Trond.Myklebust@netapp.com>2011-01-06 20:46:32 +0100
commitfc1794c5b04f5322bad05385cd91b52ec85aab72 (patch)
tree9d77a81dcdf6f858e20c8d8224e44dac13644dd5 /fs/nfs
parentpnfs: add layout to client list before sending rpc (diff)
downloadlinux-fc1794c5b04f5322bad05385cd91b52ec85aab72.tar.xz
linux-fc1794c5b04f5322bad05385cd91b52ec85aab72.zip
pnfs: check that partial LAYOUTGET return is ignored
Either a bad server reply, or our ignoring of multiple array segments in a reply, can cause a reply to not meet our requirements. Ensure that we ignore such replies. Signed-off-by: Fred Isaman <iisaman@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/pnfs.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index c00b673261f9..cd9906415a14 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -660,6 +660,17 @@ pnfs_layout_process(struct nfs4_layoutget *lgp)
struct inode *ino = lo->plh_inode;
int status = 0;
+ /* Verify we got what we asked for.
+ * Note that because the xdr parsing only accepts a single
+ * element array, this can fail even if the server is behaving
+ * correctly.
+ */
+ if (lgp->args.range.iomode > res->range.iomode ||
+ res->range.offset != 0 ||
+ res->range.length != NFS4_MAX_UINT64) {
+ status = -EINVAL;
+ goto out;
+ }
/* Inject layout blob into I/O device driver */
lseg = NFS_SERVER(ino)->pnfs_curr_ld->alloc_lseg(lo, res);
if (!lseg || IS_ERR(lseg)) {