Skip to content

Commit

Permalink
nfsd: remove /proc/fs/nfs when create /proc/fs/nfs/exports error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
fanchaoting authored and J. Bruce Fields committed Apr 3, 2013
1 parent b022032 commit ff7c4b3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fs/nfsd/nfsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit ff7c4b3

Please sign in to comment.