summaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2019-08-03 10:28:18 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-08-16 10:13:57 +0200
commit199e8a4385e2c0d008a8b1cf1c77fabc06cb594d (patch)
treec0656b0c9f82946ab71088eb1b78fbf28a29e6a7 /fs/nfs
parent5a72bf90d7870c1bbd851351c631e1a6b29b5f05 (diff)
downloadlinux-stable-199e8a4385e2c0d008a8b1cf1c77fabc06cb594d.tar.gz
linux-stable-199e8a4385e2c0d008a8b1cf1c77fabc06cb594d.tar.bz2
linux-stable-199e8a4385e2c0d008a8b1cf1c77fabc06cb594d.zip
NFSv4: Fix an Oops in nfs4_do_setattr
commit 09a54f0ebfe263bc27c90bbd80187b9a93283887 upstream. If the user specifies an open mode of 3, then we don't have a NFSv4 state attached to the context, and so we Oops when we try to dereference it. Reported-by: Olga Kornievskaia <aglo@umich.edu> Fixes: 29b59f9416937 ("NFSv4: change nfs4_do_setattr to take...") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> Cc: stable@vger.kernel.org # v4.10: 991eedb1371dc: NFSv4: Only pass the... Cc: stable@vger.kernel.org # v4.10+ Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4proc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 68e7a6bb2ce0..6409ff4876cb 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2966,7 +2966,7 @@ static int _nfs4_do_setattr(struct inode *inode,
if (nfs4_copy_delegation_stateid(inode, FMODE_WRITE, &arg->stateid, &delegation_cred)) {
/* Use that stateid */
- } else if (ctx != NULL) {
+ } else if (ctx != NULL && ctx->state) {
struct nfs_lock_context *l_ctx;
if (!nfs4_valid_open_stateid(ctx->state))
return -EBADF;