linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Colin Walters" <walters@verbum.org>
To: "Christian Brauner" <brauner@kernel.org>,
	"Amir Goldstein" <amir73il@gmail.com>,
	"Miklos Szeredi" <miklos@szeredi.hu>
Cc: linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org
Subject: Re: [PATCH v2 1/2] ovl: port to new mount api
Date: Fri, 09 Jun 2023 12:09:08 -0400	[thread overview]
Message-ID: <4229ded1-5c61-42fc-aaf9-50fc9c756885@betaapp.fastmail.com> (raw)
In-Reply-To: <20230605-fs-overlayfs-mount_api-v2-1-3da91c97e0c0@kernel.org>

Cool work.  It will be interesting to do some performance testing on what does it actually look like to create ~500 or whatever overlayfs layers now that we can.

On Fri, Jun 9, 2023, at 11:41 AM, Christian Brauner wrote:
> 
> +static int ovl_init_fs_context(struct fs_context *fc)
> +{
> +	struct ovl_fs_context *ctx = NULL;
> +	struct ovl_fs *ofs = NULL;
> +
> +	ctx = kzalloc(sizeof(*ctx), GFP_KERNEL_ACCOUNT);
> +	if (!ctx)
> +		goto out_err;

It looks to me like in this case, ofs will be NULL, then:

> +out_err:
> +	ovl_fs_context_free(ctx);
> +	ovl_free_fs(ofs);

And then we'll jump here and `ovl_free_fs` is not NULL safe.

I think the previous code was correct here as it just jumped directly to "out:".


(I've always wondered why there's no usage of __attribute__((cleanup)) in kernel code and in our userspace code doing that we have the free functions be no-ops on NULL which systematically avoids these bugs, but then again maybe the real fix is Rust ;) )

  reply	other threads:[~2023-06-09 16:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 15:41 [PATCH v2 0/2] ovl: port to new mount api & updated layer parsing Christian Brauner
2023-06-09 15:41 ` [PATCH v2 1/2] ovl: port to new mount api Christian Brauner
2023-06-09 16:09   ` Colin Walters [this message]
2023-06-10  7:18     ` Christian Brauner
2023-06-09 19:25   ` Amir Goldstein
2023-06-10  7:15     ` Christian Brauner
2023-06-09 15:41 ` [PATCH v2 2/2] ovl: modify layer parameter parsing Christian Brauner
2023-06-09 19:52   ` Amir Goldstein
2023-06-10  7:13     ` Christian Brauner
2023-06-09 19:30 ` [PATCH v2 0/2] ovl: port to new mount api & updated layer parsing Amir Goldstein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4229ded1-5c61-42fc-aaf9-50fc9c756885@betaapp.fastmail.com \
    --to=walters@verbum.org \
    --cc=amir73il@gmail.com \
    --cc=brauner@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).