Re: [PATCH v30 02/12] landlock: Add ruleset and domain management

Kees Cook
2021-03-19T19:16:24Z

On Fri, Mar 19, 2021 at 08:03:22PM +0100, Mickaël Salaün wrote:
> On 19/03/2021 19:40, Kees Cook wrote:
> > On Tue, Mar 16, 2021 at 09:42:42PM +0100, Mickaël Salaün wrote:
> >> [...]
> >> +static void put_rule(struct landlock_rule *const rule)
> >> +{
> >> + might_sleep();
> >> + if (!rule)
> >> + return;
> >> + landlock_put_object(rule->object);
> >> + kfree(rule);
> >> +}
> >
> > I'd expect this to be named "release" rather than "put" since it doesn't
> > do any lifetime reference counting.
>
> It does decrement rule->object->usage .

Well, landlock_put_object() decrements rule->object's lifetime. It seems
"rule" doesn't have a lifetime. (There is no refcounter on rule.) I just
find it strange to see "put" without a matching "get". Not a big deal.

--
Kees Cook