]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - fs/file.c
tg3: adapt tg3 to use reworked PCI PM code
[linux-2.6-omap-h63xx.git] / 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);
+
+       /*
+        * 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;