exec: Allow load_misc_binary to call prepare_binprm unconditionally
[sfrench/cifs-2.6.git] / fs / binfmt_misc.c
index cdb45829354d9f6db769ac0d83db44fed57c919e..264829745d6fcf6970eb4b5e3b4cfa05f5f5a070 100644 (file)
@@ -218,19 +218,10 @@ static int load_misc_binary(struct linux_binprm *bprm)
                goto error;
 
        bprm->file = interp_file;
-       if (fmt->flags & MISC_FMT_CREDENTIALS) {
-               loff_t pos = 0;
-
-               /*
-                * No need to call prepare_binprm(), it's already been
-                * done.  bprm->buf is stale, update from interp_file.
-                */
-               memset(bprm->buf, 0, BINPRM_BUF_SIZE);
-               retval = kernel_read(bprm->file, bprm->buf, BINPRM_BUF_SIZE,
-                               &pos);
-       } else
-               retval = prepare_binprm(bprm);
+       if (fmt->flags & MISC_FMT_CREDENTIALS)
+               bprm->preserve_creds = 1;
 
+       retval = prepare_binprm(bprm);
        if (retval < 0)
                goto error;