projects
/
firefly-linux-kernel-4.4.55.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
[firefly-linux-kernel-4.4.55.git]
/
fs
/
file.c
diff --git
a/fs/file.c
b/fs/file.c
index 7b3887e054d0bcb5e0e187c8e1e42691c4fadcd0..d8773b19fe47fd23d6bbec2149679b123a79c139 100644
(file)
--- 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);
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;
/* Do we need to expand? */
if (nr < fdt->max_fds)
return 0;
+
/* Can we expand? */
if (nr >= sysctl_nr_open)
return -EMFILE;
/* Can we expand? */
if (nr >= sysctl_nr_open)
return -EMFILE;