From patchwork Wed Mar 27 08:31:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: fanchaoting X-Patchwork-Id: 2348091 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 68327400E6 for ; Wed, 27 Mar 2013 08:31:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752730Ab3C0Iax (ORCPT ); Wed, 27 Mar 2013 04:30:53 -0400 Received: from cn.fujitsu.com ([222.73.24.84]:46195 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752740Ab3C0Iav (ORCPT ); Wed, 27 Mar 2013 04:30:51 -0400 X-IronPort-AV: E=Sophos;i="4.87,358,1363104000"; d="scan'208";a="6954377" Received: from unknown (HELO tang.cn.fujitsu.com) ([10.167.250.3]) by song.cn.fujitsu.com with ESMTP; 27 Mar 2013 16:28:17 +0800 Received: from fnstmail02.fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id r2R8UlGT003957; Wed, 27 Mar 2013 16:30:49 +0800 Received: from [127.0.0.1] ([10.167.233.142]) by fnstmail02.fnst.cn.fujitsu.com (Lotus Domino Release 8.5.3) with ESMTP id 2013032716295976-96917 ; Wed, 27 Mar 2013 16:29:59 +0800 Message-ID: <5152AE56.5010306@cn.fujitsu.com> Date: Wed, 27 Mar 2013 16:31:18 +0800 From: fanchaoting User-Agent: Thunderbird 2.0.0.9 (Windows/20071031) MIME-Version: 1.0 To: "bfields@fieldses.org" CC: "linux-nfs@vger.kernel.org" Subject: [PATCH 1/2] nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error X-MIMETrack: Itemize by SMTP Server on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/27 16:29:59, Serialize by Router on mailserver/fnst(Release 8.5.3|September 15, 2011) at 2013/03/27 16:30:02, Serialize complete at 2013/03/27 16:30:02 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org when create /proc/fs/nfs/exports error, we should remove /proc/fs/nfs, if don't do it, it maybe cause Memory leak. Signed-off-by: fanchaoting Reviewed-by: chendt.fnst --- fs/nfsd/nfsctl.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index f33455b..58e4db4 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -1102,8 +1102,10 @@ static int create_proc_exports_entry(void) return -ENOMEM; entry = proc_create("exports", 0, entry, &exports_proc_operations); - if (!entry) + if (!entry) { + remove_proc_entry("fs/nfs", NULL); return -ENOMEM; + } return 0; } #else /* CONFIG_PROC_FS */