This is a note to let you know that I've just added the patch titled NFSv4: Fix state reference counting in _nfs4_opendata_reclaim_to_nfs4_state to the 3.12-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-state-reference-counting-in-_nfs4_opendata_reclaim_to_nfs4_state.patch and it can be found in the queue-3.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From d49f042aeec99c5f87160bb52dd52088b1051311 Mon Sep 17 00:00:00 2001 From: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> Date: Mon, 28 Oct 2013 14:57:12 -0400 Subject: NFSv4: Fix state reference counting in _nfs4_opendata_reclaim_to_nfs4_state From: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> commit d49f042aeec99c5f87160bb52dd52088b1051311 upstream. Currently, if the call to nfs_refresh_inode fails, then we end up leaking a reference count, due to the call to nfs4_get_open_state. While we're at it, replace nfs4_get_open_state with a simple call to atomic_inc(); there is no need to do a full lookup of the struct nfs_state since it is passed as an argument in the struct nfs4_opendata, and is already assigned to the variable 'state'. Signed-off-by: Trond Myklebust <Trond.Myklebust@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/nfs/nfs4proc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -1326,11 +1326,6 @@ _nfs4_opendata_reclaim_to_nfs4_state(str goto update; } - ret = -ENOMEM; - state = nfs4_get_open_state(inode, data->owner); - if (state == NULL) - goto err; - ret = nfs_refresh_inode(inode, &data->f_attr); if (ret) goto err; @@ -1342,6 +1337,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(str update: update_open_stateid(state, &data->o_res.stateid, NULL, data->o_arg.fmode); + atomic_inc(&state->count); return state; err: Patches currently in stable-queue which might be from Trond.Myklebust@xxxxxxxxxx are queue-3.12/nfsv4.2-fix-a-mismatch-between-linux-labeled-nfs-and-the-nfsv4.2-spec.patch queue-3.12/nfs-fix-oops-when-trying-to-set-selinux-label.patch queue-3.12/nfs-fix-a-missing-initialisation-when-reading-the-selinux-label.patch queue-3.12/nfsv4-fix-a-use-after-free-situation-in-_nfs4_proc_getlk.patch queue-3.12/nfs-fix-inverted-test-for-delegation-in-nfs4_reclaim_open_state.patch queue-3.12/nfsv4-fix-null-dereference-in-open-recover.patch queue-3.12/nfs-don-t-retry-detect_trunking-with-rpc_auth_unix-more-than-once.patch queue-3.12/nfsv4-don-t-reprocess-cached-open-claim_previous.patch queue-3.12/nfsv4-fix-state-reference-counting-in-_nfs4_opendata_reclaim_to_nfs4_state.patch queue-3.12/nfsv4-don-t-fail-on-missing-fattr-in-open-recover.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html