diff options
author | Trond Myklebust <trond.myklebust@primarydata.com> | 2017-02-02 02:42:44 +0100 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@hammerspace.com> | 2018-05-31 21:03:11 +0200 |
commit | d49e0d5b999621412ffb177f08a1c1746dfb6071 (patch) | |
tree | 8da9556b8140531e27f180cd726dba6e8e3e8cba /fs/nfs/pnfs.c | |
parent | pnfs: Fix manipulation of NFS_LAYOUT_FIRST_LAYOUTGET (diff) | |
download | linux-d49e0d5b999621412ffb177f08a1c1746dfb6071.tar.xz linux-d49e0d5b999621412ffb177f08a1c1746dfb6071.zip |
NFSv4/pnfs: Ensure pnfs_parse_lgopen() won't try to parse uninitialised data
We need to ensure that pnfs_parse_lgopen() doesn't try to parse a
struct nfs4_layoutget_res that was not filled by a successful call
to decode_layoutget(). This can happen if we performed a cached open,
or if either the OP_ACCESS or OP_GETATTR operations preceding the
OP_LAYOUTGET in the compound returned an error.
By initialising the 'status' field to NFS4ERR_DELAY, we ensure that
pnfs_parse_lgopen() won't try to interpret the structure.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to '')
-rw-r--r-- | fs/nfs/pnfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index b0e42fd07cb1..4d3f04d55a65 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -994,7 +994,8 @@ pnfs_alloc_init_layoutget_args(struct inode *ino, lgp->args.layout.pglen = max_pages * PAGE_SIZE; lgp->res.layoutp = &lgp->args.layout; - + /* Don't confuse uninitialised result and success */ + lgp->res.status = -NFS4ERR_DELAY; lgp->args.minlength = PAGE_SIZE; if (lgp->args.minlength > range->length) |