[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Yeg0zoI8d3oyWuzw@localhost.localdomain>
Date: Wed, 19 Jan 2022 18:57:02 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: stephen.s.brennan@...cle.com
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
stephen.s.brennan@...cle.com, legion@...nel.org,
viro@...iv.linux.org.uk, ebiederm@...ssion.com,
akpm@...ux-foundation.org
Subject: Re: [PATCH v2] proc: "mount -o lookup=" support
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.
Powered by blists - more mailing lists