From patchwork Mon Sep 10 14:54:43 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "J. Bruce Fields" X-Patchwork-Id: 1432421 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 35148DF28C for ; Mon, 10 Sep 2012 14:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753526Ab2IJOyp (ORCPT ); Mon, 10 Sep 2012 10:54:45 -0400 Received: from fieldses.org ([174.143.236.118]:40394 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753067Ab2IJOyo (ORCPT ); Mon, 10 Sep 2012 10:54:44 -0400 Received: from bfields by fieldses.org with local (Exim 4.76) (envelope-from ) id 1TB5Nr-0000AH-Az; Mon, 10 Sep 2012 10:54:43 -0400 Date: Mon, 10 Sep 2012 10:54:43 -0400 To: linux-nfs@vger.kernel.org Cc: cbay@excellency.fr Subject: [PATCH] nfsd4: fix nfs4 stateid leak Message-ID: <20120910145443.GD30136@fieldses.org> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) From: "J. Bruce Fields" Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: "J. Bruce Fields" 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. Tested-by: Cyril B. Cc: stable@vger.kernel.org Signed-off-by: J. Bruce Fields --- fs/nfsd/nfs4state.c | 1 + 1 file changed, 1 insertion(+) Queuing up for 3.7 and -stable.--b. diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 5f1a91a..6686e74 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)) {