public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix bug: flat binary loader doesn't check fd table full
@ 2006-03-23  7:10 Luke Yang
  2006-03-23  7:46 ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Luke Yang @ 2006-03-23  7:10 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply related	[flat|nested] 7+ messages in thread
[parent not found: <5Tsh4-2q0-13@gated-at.bofh.it>]

end of thread, other threads:[~2006-03-26 11:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-23  7:10 [PATCH] Fix bug: flat binary loader doesn't check fd table full Luke Yang
2006-03-23  7:46 ` Andrew Morton
     [not found]   ` <489ecd0c0603230115h4dd2b16fg54cfd97739a8b339@mail.gmail.com>
2006-03-23  9:17     ` Andrew Morton
2006-03-25  4:53       ` Paul Jackson
2006-03-25 15:26         ` Luke Yang
2006-03-25 21:06           ` Andrew Morton
     [not found] <5Tsh4-2q0-13@gated-at.bofh.it>
     [not found] ` <5TsTM-3aB-1@gated-at.bofh.it>
     [not found]   ` <5Tuj1-5lw-31@gated-at.bofh.it>
     [not found]     ` <5Tuj1-5lw-29@gated-at.bofh.it>
     [not found]       ` <5U92I-6ki-11@gated-at.bofh.it>
     [not found]         ` <5UiSm-3FG-17@gated-at.bofh.it>
2006-03-26 11:34           ` Bodo Eggert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox