From: Alexey Dobriyan <adobriyan@gmail.com>
To: Christian Brauner <brauner@kernel.org>
Cc: linux-fsdevel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Chris Mason <mason@kernel.org>, Al Viro <viro@zeniv.linux.org.uk>,
Christoph Hellwig <hch@lst.de>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
akpm@linux-foundation.org
Subject: Re: [PATCH RFC 18/38] proc: don't WARN about a name that is already registered
Date: Wed, 4 Nov 2026 21:43:43 +0300 [thread overview]
Message-ID: <9cb48eaf-72f2-4e9f-b979-1ead58deb22f@p183> (raw)
> --- a/fs/proc/generic.c
> +++ b/fs/proc/generic.c
> @@ -401,9 +401,10 @@ struct proc_dir_entry *proc_register(struct proc_dir_entry *dir,
> write_lock(&proc_subdir_lock);
> dp->parent = dir;
> if (pde_subdir_insert(dir, dp) == false) {
> - WARN(1, "proc_dir_entry '%s/%s' already registered\n",
> - dir->name, dp->name);
> write_unlock(&proc_subdir_lock);
> + pr_warn("proc_dir_entry '%s/%s' already registered\n",
> + dir->name, dp->name);
> + dump_stack();
> goto out_free_inum;
> }
> write_unlock(&proc_subdir_lock);
I don't like this patch.
WARN is there to make bugs noticeable, /proc entries aren't supposed to be
created randomly unlike regular files so deleting non-existent name or
registering twice is probably a bug.
Now, some names do come from userspace but it is up to subsystems to
find duplicates and return errors (and sanitize for dots/slashes!).
In userspace mkdir;mkdir returns error second time, as well as
unlink;unlink. In kernel error is BUG/WARN (like it is now) and it is up
to subsystem to evade it.
/proc/alexey
next reply other threads:[~2026-11-04 18:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 18:43 Alexey Dobriyan [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-11-02 14:21 [PATCH RFC 00/38] proc: fix a few old bugs in /proc handlers Christian Brauner
2026-11-02 14:21 ` [PATCH RFC 18/38] proc: don't WARN about a name that is already registered Christian Brauner
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=9cb48eaf-72f2-4e9f-b979-1ead58deb22f@p183 \
--to=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mason@kernel.org \
--cc=stable@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--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
all inboxes | Powered by JetHome®