X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=fs%2Ffile.c;h=d8773b19fe47fd23d6bbec2149679b123a79c139;hb=12dac0756d357325b107fe6ec24921ec38661839;hp=7b3887e054d0bcb5e0e187c8e1e42691c4fadcd0;hpb=8033c6e9736c29cce5f0d0abbca9a44dffb20c39;p=linux-2.6-omap-h63xx.git diff --git a/fs/file.c b/fs/file.c index 7b3887e054d..d8773b19fe4 100644 --- a/fs/file.c +++ b/fs/file.c @@ -250,9 +250,18 @@ int expand_files(struct files_struct *files, int nr) struct fdtable *fdt; fdt = files_fdtable(files); + + /* + * N.B. For clone tasks sharing a files structure, this test + * will limit the total number of files that can be opened. + */ + if (nr >= current->signal->rlim[RLIMIT_NOFILE].rlim_cur) + return -EMFILE; + /* Do we need to expand? */ if (nr < fdt->max_fds) return 0; + /* Can we expand? */ if (nr >= sysctl_nr_open) return -EMFILE;