Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux...
[linux-2.6-block.git] / fs / exec.c
index fdecb7615587df4e888bf357ccd6a3cc4640936b..e92419fd78b326720ae97f70198f3aa399c58436 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1400,7 +1400,12 @@ static void bprm_fill_uid(struct linux_binprm *bprm)
        kuid_t uid;
        kgid_t gid;
 
-       /* clear any previous set[ug]id data from a previous binary */
+       /*
+        * Since this can be called multiple times (via prepare_binprm),
+        * we must clear any previous work done when setting set[ug]id
+        * bits from any earlier bprm->file uses (for example when run
+        * first for a setuid script then again for its interpreter).
+        */
        bprm->cred->euid = current_euid();
        bprm->cred->egid = current_egid();