From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:33140 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755281AbdCJIkX (ORCPT ); Fri, 10 Mar 2017 03:40:23 -0500 Subject: Patch "NFSv4: Fix memory and state leak in _nfs4_open_and_get_state" has been added to the 4.10-stable tree To: trond.myklebust@primarydata.com, Anna.Schumaker@Netapp.com, gregkh@linuxfoundation.org Cc: , From: Date: Fri, 10 Mar 2017 09:38:48 +0100 Message-ID: <148913512823016@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled NFSv4: Fix memory and state leak in _nfs4_open_and_get_state to the 4.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: nfsv4-fix-memory-and-state-leak-in-_nfs4_open_and_get_state.patch and it can be found in the queue-4.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From a974deee477af89411e0f80456bfb344ac433c98 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Wed, 8 Feb 2017 11:29:46 -0500 Subject: NFSv4: Fix memory and state leak in _nfs4_open_and_get_state From: Trond Myklebust 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 Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman --- fs/nfs/nfs4proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -2730,6 +2730,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) @@ -2755,7 +2756,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)) Patches currently in stable-queue which might be from trond.myklebust@primarydata.com are queue-4.10/nfsv4-fix-reboot-recovery-in-copy-offload.patch queue-4.10/revert-nfsv4.1-handle-nfs4err_badsession-nfs4err_deadsession-replies-to-op_sequence.patch queue-4.10/pnfs-flexfiles-if-the-layout-is-invalid-it-must-be-updated-before-retrying.patch queue-4.10/nfsv4-fix-memory-and-state-leak-in-_nfs4_open_and_get_state.patch