]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error
authorfanchaoting <fanchaoting@cn.fujitsu.com>
Wed, 27 Mar 2013 08:31:18 +0000 (16:31 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 3 Apr 2013 19:30:07 +0000 (15:30 -0400)
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 <fanchaoting@cn.fujitsu.com>
Reviewed-by: chendt.fnst <chendt.fnst@cn.fujitsu.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfsctl.c

index a830f33df3ef84622c0f1048dc8f81a20d8d5a92..68a4d320cd14f577e6719f0761a136055dccdd4b 100644 (file)
@@ -1111,8 +1111,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 */