Linux-NFS Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] NFSv4: Fix an Oops in nfs4_do_setattr
@ 2019-08-03 14:43 Trond Myklebust
  2019-08-05 16:38 ` Olga Kornievskaia
  0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2019-08-03 14:43 UTC (permalink / raw)
  To: Olga Kornievskaia; +Cc: linux-nfs

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+
---
 fs/nfs/nfs4proc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 3e0b93f2b61a..12b2b65ad8a8 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -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;
-- 
2.21.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] NFSv4: Fix an Oops in nfs4_do_setattr
  2019-08-03 14:43 [PATCH] NFSv4: Fix an Oops in nfs4_do_setattr Trond Myklebust
@ 2019-08-05 16:38 ` Olga Kornievskaia
  0 siblings, 0 replies; 2+ messages in thread
From: Olga Kornievskaia @ 2019-08-05 16:38 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

On Sat, Aug 3, 2019 at 10:45 AM Trond Myklebust <trondmy@gmail.com> wrote:
>
> 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+
> ---
>  fs/nfs/nfs4proc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 3e0b93f2b61a..12b2b65ad8a8 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -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;

Thank you Trond. No longer oops-ing with this patch.

> --
> 2.21.0
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-03 14:43 [PATCH] NFSv4: Fix an Oops in nfs4_do_setattr Trond Myklebust
2019-08-05 16:38 ` Olga Kornievskaia

Linux-NFS Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nfs/0 linux-nfs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nfs linux-nfs/ https://lore.kernel.org/linux-nfs \
		linux-nfs@vger.kernel.org linux-nfs@archiver.kernel.org
	public-inbox-index linux-nfs


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-nfs


AGPL code for this site: git clone https://public-inbox.org/ public-inbox