mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luke Yang" <luke.adi@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] Fix bug: flat binary loader doesn't check fd table full
Date: Thu, 23 Mar 2006 15:10:11 +0800	[thread overview]
Message-ID: <489ecd0c0603222310j3f2b9804k30bca1adce33804d@mail.gmail.com> (raw)

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

             reply	other threads:[~2006-03-23  7:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-23  7:10 Luke Yang [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=489ecd0c0603222310j3f2b9804k30bca1adce33804d@mail.gmail.com \
    --to=luke.adi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®