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.