Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09a54f0e authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4: Fix an Oops in nfs4_do_setattr



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: default avatarOlga Kornievskaia <aglo@umich.edu>
Fixes: 29b59f94 ("NFSv4: change nfs4_do_setattr to take...")
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.10: 991eedb1: NFSv4: Only pass the...
Cc: stable@vger.kernel.org # v4.10+
parent c77e2283
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -3214,7 +3214,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;