public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexey Dobriyan <adobriyan@gmail.com>
To: stephen.s.brennan@oracle.com
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	stephen.s.brennan@oracle.com, legion@kernel.org,
	viro@zeniv.linux.org.uk, ebiederm@xmission.com,
	akpm@linux-foundation.org
Subject: Re: [PATCH v2] proc: "mount -o lookup=" support
Date: Wed, 19 Jan 2022 18:57:02 +0300	[thread overview]
Message-ID: <Yeg0zoI8d3oyWuzw@localhost.localdomain> (raw)
In-Reply-To: <YegysyqL3LvljK66@localhost.localdomain>

On Wed, Jan 19, 2022 at 06:48:03PM +0300, Alexey Dobriyan wrote:
> 	# mount -t proc -o lookup=/ proc /proc

> +static int proc_fs_context_dup(struct fs_context *fc, struct fs_context *src_fc)
> +{
> +	struct proc_fs_context *src = fc->fs_private;
> +	struct proc_fs_context *dst;
> +
> +	dst = kmemdup(src, sizeof(struct proc_fs_context), GFP_KERNEL);
> +	if (!dst) {
> +		return -ENOMEM;
> +	}
> +
> +	dst->lookup_list = kmemdup(dst->lookup_list, dst->lookup_list_len, GFP_KERNEL);
> +	if (!dst->lookup_list) {
> +		kfree(dst);
> +		return -ENOMEM;
> +	}
> +	get_pid_ns(dst->pid_ns);
> +
> +	fc->fs_private = dst;
> +	return 0;
> +}

Stephen, sorry for not replying earlier.

I don't pretend to understand fully what ->dup() is supposed to do.
And the above code was not tested.

In particular

	p->a = kmemdup(p->a, ...)

reads like "MEMORY LEAK" on the first glance but it is not.

Understanding ->dup is the next thing.

  reply	other threads:[~2022-01-19 15:57 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 15:48 [PATCH v2] proc: "mount -o lookup=" support Alexey Dobriyan
2022-01-19 15:57 ` Alexey Dobriyan [this message]
2022-01-19 16:24 ` Christian Brauner
2022-01-19 17:15   ` Alexey Gladkov
2022-01-19 17:31     ` Christian Brauner
2022-01-19 18:30       ` Alexey Gladkov
2022-01-20 12:23   ` Alexey Dobriyan
2022-01-20 14:37     ` Christian Brauner
2022-01-20 12:32   ` Alexey Dobriyan
2022-01-19 17:04 ` Alexey Gladkov
2022-01-20 12:26   ` Alexey Dobriyan

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=Yeg0zoI8d3oyWuzw@localhost.localdomain \
    --to=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=ebiederm@xmission.com \
    --cc=legion@kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stephen.s.brennan@oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    /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