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, 30 Nov 2023 10:13:41 -0800
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Simon Horman <horms@...nel.org>
Cc: Andrii Nakryiko <andrii@...nel.org>, bpf@...r.kernel.org, netdev@...r.kernel.org, 
	paul@...l-moore.com, brauner@...nel.org, linux-fsdevel@...r.kernel.org, 
	linux-security-module@...r.kernel.org, keescook@...omium.org, 
	kernel-team@...a.com, sargun@...gun.me
Subject: Re: [PATCH v11 bpf-next 02/17] bpf: add BPF token delegation mount
 options to BPF FS

On Thu, Nov 30, 2023 at 10:03 AM Andrii Nakryiko
<andrii.nakryiko@...il.com> wrote:
>
> On Thu, Nov 30, 2023 at 8:37 AM Simon Horman <horms@...nel.org> wrote:
> >
> > On Mon, Nov 27, 2023 at 11:03:54AM -0800, Andrii Nakryiko wrote:
> >
> > ...
> >
> > > @@ -764,7 +817,10 @@ static int bpf_get_tree(struct fs_context *fc)
> > >
> > >  static void bpf_free_fc(struct fs_context *fc)
> > >  {
> > > -     kfree(fc->fs_private);
> > > +     struct bpf_mount_opts *opts = fc->s_fs_info;
> > > +
> > > +     if (opts)
> > > +             kfree(opts);
> > >  }
> >
> > Hi Andrii,
> >
> > as it looks like there will be a v12, I have a minor nit to report: There
> > is no need to check if opts is non-NULL because kfree() is basically a
> > no-op if it's argument is NULL.
> >
> > So perhaps this can become (completely untested!):
> >
> > static void bpf_free_fc(struct fs_context *fc)
> > {
> >         kfree(fc->s_fs_info);
> > }
> >
>
> sure, I can drop the check, I wasn't sure if it's canonical or not to
> check the argument for NULL before calling kfree(). For user-space
> it's definitely quite expected to not have to check for null before
> calling free().

Heh, turns out I already simplified this, but it's in the next patch.
I'll move it into patch #2, though, where it actually belongs.

>
>
> > ...

Powered by blists - more mailing lists