]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
nfsd4: fix nfs4 stateid leak
authorJ. Bruce Fields <bfields@redhat.com>
Wed, 29 Aug 2012 22:21:58 +0000 (15:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 21 Oct 2012 16:27:57 +0000 (09:27 -0700)
commit cf9182e90b2af04245ac4fae497fe73fc71285b4 upstream.

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>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4state.c

index e79c24e232f42cd83c389c125bfe916013819088..a2f99d155840af457f6ce6f7e9240be5580d41db 100644 (file)
@@ -3783,6 +3783,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;
 
        /* place unused nfs4_stateowners on so_close_lru list to be