Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1597092 > unrolled thread

[PATCH 4.9 125/153] NFSv4: Fix memory and state leak in _nfs4_open_and_get_state

Started byGreg Kroah-Hartman <gregkh@linuxfoundation.org>
First post2017-03-10 12:00 +0100
Last post2017-03-10 12:00 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4.9 125/153] NFSv4: Fix memory and state leak in _nfs4_open_and_get_state Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-03-10 12:00 +0100

#1597092 — [PATCH 4.9 125/153] NFSv4: Fix memory and state leak in _nfs4_open_and_get_state

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-03-10 12:00 +0100
Subject[PATCH 4.9 125/153] NFSv4: Fix memory and state leak in _nfs4_open_and_get_state
Message-ID<tjqr9-2Qu-47@gated-at.bofh.it>
4.9-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Trond Myklebust <trond.myklebust@primarydata.com>

commit a974deee477af89411e0f80456bfb344ac433c98 upstream.

If we exit because the file access check failed, we currently
leak the struct nfs4_state. We need to attach it to the
open context before returning.

Fixes: 3efb9722475e ("NFSv4: Refactor _nfs4_open_and_get_state..")
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/nfs/nfs4proc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2708,6 +2708,7 @@ static int _nfs4_open_and_get_state(stru
 	ret = PTR_ERR(state);
 	if (IS_ERR(state))
 		goto out;
+	ctx->state = state;
 	if (server->caps & NFS_CAP_POSIX_LOCK)
 		set_bit(NFS_STATE_POSIX_LOCKS, &state->flags);
 	if (opendata->o_res.rflags & NFS4_OPEN_RESULT_MAY_NOTIFY_LOCK)
@@ -2733,7 +2734,6 @@ static int _nfs4_open_and_get_state(stru
 	if (ret != 0)
 		goto out;
 
-	ctx->state = state;
 	if (d_inode(dentry) == state->inode) {
 		nfs_inode_attach_open_context(ctx);
 		if (read_seqcount_retry(&sp->so_reclaim_seqcount, seq))

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web