[PATCH] Fix bug: flat binary loader doesn't check fd table full

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

   In the binfmt_flat.c, the flat binary loader should check file
descriptor table and install the fd on the file.

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 108d56b..6388187 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
@@ -493,6 +493,13 @@ static int load_flat_file(struct linux_b
        if (data_len + bss_len > rlim)
                return -ENOMEM;

+       /* check file descriptor */
+       int retval = get_unused_fd();
+       if (retval < 0)
+               return -EMFILE;
+       get_file(bprm->file);
+       fd_install(retval, bprm->file);
+
        /* Flush all traces of the currently running executable */
        if (id == 0) {
                result = flush_old_exec(bprm);

signed-off-by: Luke Yang <[email protected]>
--
Best regards,
Luke Yang
[email protected]; [email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux