瀏覽代碼

nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error

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>
fanchaoting 12 年之前
父節點
當前提交
ff7c4b3693
共有 1 個文件被更改,包括 3 次插入1 次删除
  1. 3 1
      fs/nfsd/nfsctl.c

+ 3 - 1
fs/nfsd/nfsctl.c

@@ -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 */