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

From: Luke Yang
Date: Thu Mar 23 2006 - 02:07:45 EST


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@xxxxxxxxx>
--
Best regards,
Luke Yang
magic.yyang@xxxxxxxxx; luke.adi@xxxxxxxxx
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/