lkml.org 
[lkml]   [2006]   [Mar]   [23]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateThu, 23 Mar 2006 15:10:11 +0800
From"Luke Yang" <>
Subject[PATCH] Fix bug: flat binary loader doesn't check fd table full
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 <luke.adi@gmail.com>
--
Best regards,
Luke Yang
magic.yyang@gmail.com; luke.adi@gmail.com
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-03-23 08:12    [from the cache]
©2003-2008