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] [day] [month] [year] [list]
Message-ID: <CAPpH65zBxNo9W3VnVsSBfNsGwvVyyw5ZMnHzqSpmMuj7NbaYJQ@mail.gmail.com>
Date:   Sat, 19 Dec 2020 00:29:05 +0100
From:   Andrea Claudi <aclaudi@...hat.com>
To:     Phil Sutter <phil@....cc>, Andrea Claudi <aclaudi@...hat.com>,
        linux-netdev <netdev@...r.kernel.org>,
        Stephen Hemminger <stephen@...workplumber.org>,
        David Ahern <dsahern@...il.com>
Subject: Re: [PATCH iproute2 2/2] lib/fs: Fix single return points for get_cgroup2_*

On Sat, Dec 19, 2020 at 12:08 AM Phil Sutter <phil@....cc> wrote:
>
> On Fri, Dec 18, 2020 at 08:09:23PM +0100, Andrea Claudi wrote:
> > Functions get_cgroup2_id() and get_cgroup2_path() uncorrectly performs
> > cleanup on the single return point. Both of them may get to use close()
> > with a negative argument, if open() fails.
> >
> > Fix this adding proper labels and gotos to make sure we clean up only
> > resources we are effectively used before.
>
> Since free(NULL) is OK according to POSIX, the fds are initialized to -1
> and open() returns -1 on error, you may simplify these
> changes down to making the close() calls conditional:
>
> | if (fd >= 0)
> |       close(fd);
>
> Cheers, Phil
>

Thanks for the suggestion, Phil. Will do in v2.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ