summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-08-30 00:21:58 +0200
committerJ. Bruce Fields <bfields@redhat.com>2012-09-10 16:55:14 +0200
commitcf9182e90b2af04245ac4fae497fe73fc71285b4 (patch)
treea4659b22d9d2b35a168cbcf7f7c057412129d0c1
parentnfsd: document kernel interfaces for nfsd configuration (diff)
downloadlinux-cf9182e90b2af04245ac4fae497fe73fc71285b4.tar.xz
linux-cf9182e90b2af04245ac4fae497fe73fc71285b4.zip
nfsd4: fix nfs4 stateid leak
Processes that open and close multiple files may end up setting this oo_last_closed_stid without freeing what was previously pointed to. This can result in a major leak, visible for example by watching the nfsd4_stateids line of /proc/slabinfo. Reported-by: Cyril B. <cbay@excellency.fr> Tested-by: Cyril B. <cbay@excellency.fr> Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields <bfields@redhat.com>
-rw-r--r--fs/nfsd/nfs4state.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 5f1a91a9cd35..6686e747223f 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -3766,6 +3766,7 @@ nfsd4_close(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
memcpy(&close->cl_stateid, &stp->st_stid.sc_stateid, sizeof(stateid_t));
nfsd4_close_open_stateid(stp);
+ release_last_closed_stateid(oo);
oo->oo_last_closed_stid = stp;
if (list_empty(&oo->oo_owner.so_stateids)) {