]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sched: balance-on-exec fix
authorAndrew Morton <akpm@osdl.org>
Thu, 3 Jun 2004 00:59:43 +0000 (17:59 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 3 Jun 2004 00:59:43 +0000 (17:59 -0700)
From: Jack Steiner <steiner@sgi.com>

It looks like the call to sched_balance_exec() from do_execve() is in the
wrong spot.  The code calls sched_balance_exec() before determining whether
"filename" actually exists.

In many cases, users have several entries in $PATH.  If a full path name is
not specified on the 'exec" call, the library code iterates thru the files
in the PATH list until it finds the program.  This can result is numerous
migrations of the parent process before the program is actually found.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/exec.c

index 4b7f44fb49efb051217e6c0abd331bc1fc4bf19b..f30b49540adbe5966dbcdfdcfd95e3854cdfc690 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1074,14 +1074,14 @@ int do_execve(char * filename,
        int retval;
        int i;
 
-       sched_balance_exec();
-
        file = open_exec(filename);
 
        retval = PTR_ERR(file);
        if (IS_ERR(file))
                return retval;
 
+       sched_balance_exec();
+
        bprm.p = PAGE_SIZE*MAX_ARG_PAGES-sizeof(void *);
        memset(bprm.page, 0, MAX_ARG_PAGES*sizeof(bprm.page[0]));