Re: [PATCH iproute2 2/2] lib/fs: Fix single return points for get_cgroup2_*

2020-12-18 Thread Andrea Claudi
On Sat, Dec 19, 2020 at 12:08 AM Phil Sutter 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

Re: [PATCH iproute2 2/2] lib/fs: Fix single return points for get_cgroup2_*

2020-12-18 Thread Phil Sutter
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

[PATCH iproute2 2/2] lib/fs: Fix single return points for get_cgroup2_*

2020-12-18 Thread Andrea Claudi
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.