Re: [PATCH 3/5] exec: Remove recursion from search_binary_handler

From: Tetsuo Handa
Date: Sun May 10 2020 - 00:24:04 EST


On 2020/05/10 4:41, Eric W. Biederman wrote:
> --- a/fs/binfmt_misc.c
> +++ b/fs/binfmt_misc.c
> @@ -234,10 +234,7 @@ static int load_misc_binary(struct linux_binprm *bprm)
> if (retval < 0)
> goto error;
>
> - retval = search_binary_handler(bprm);
> - if (retval < 0)
> - goto error;
> -
> + retval = 1; /* Search for the interpreter */
> ret:
> dput(fmt->dentry);
> return retval;

Wouldn't this change cause

if (fd_binary > 0)
ksys_close(fd_binary);
bprm->interp_flags = 0;
bprm->interp_data = 0;

not to be called when "Search for the interpreter" failed?