lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 10 Feb 2022 09:53:32 +0900
From:   Masahiro Yamada <masahiroy@...nel.org>
To:     Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Cc:     Ryan Cai <ycaibb@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kconfig: fix missing fclose() on error paths

On Tue, Feb 8, 2022 at 3:26 PM Masahiro Yamada <masahiroy@...nel.org> wrote:
>
> The file is not closed when ferror() fails.
>
> Fixes: 00d674cb3536 ("kconfig: refactor conf_write_dep()")
> Fixes: 57ddd07c4560 ("kconfig: refactor conf_write_autoconf()")
> Reported-by: Ryan Cai <ycaibb@...il.com>
> Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
> ---


Applied to linux-kbuild/fixes.


>
>  scripts/kconfig/confdata.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index 59717be31210..16897cb8cefd 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -979,10 +979,10 @@ static int conf_write_autoconf_cmd(const char *autoconf_name)
>
>         fprintf(out, "\n$(deps_config): ;\n");
>
> -       if (ferror(out)) /* error check for all fprintf() calls */
> -               return -1;
> -
> +       ret = ferror(out); /* error check for all fprintf() calls */
>         fclose(out);
> +       if (ret)
> +               return -1;
>
>         if (rename(tmp, name)) {
>                 perror("rename");
> @@ -1093,10 +1093,10 @@ static int __conf_write_autoconf(const char *filename,
>                         print_symbol(file, sym);
>
>         /* check possible errors in conf_write_heading() and print_symbol() */
> -       if (ferror(file))
> -               return -1;
> -
> +       ret = ferror(file);
>         fclose(file);
> +       if (ret)
> +               return -1;
>
>         if (rename(tmp, filename)) {
>                 perror("rename");
> --
> 2.32.0
>


-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ