pfs_create_file(), pfs_create_dir() and pfs_create_link() link the new node
into its parent and return, and only then do the debugfs_create_*()
functions set pn_data. Between the two, the node can already be found by a
lookup but pn_data is NULL, so a concurrent stat(2) or read(2) calls
debugfs_attr(), debugfs_fill() or debugfs_fill_data() which dereference it:
a driver creating debugfs entries while lindebugfs is mounted can panic
whoever is looking at the tree at that moment. The window is only a few
instructions wide, which made it hard to hit; with a delay added on purpose
it panics at once in debugfs_attr() called from stat(2).
Changing pfs_create_*() to take the data would change the pseudofs API and
ABI. Use the visibility callback instead: pseudofs checks it before
creating a vnode for a node and before getattr, read and write, so a
node whose pn_data is not set yet is reported as not visible and lookups
return ENOENT. The data is published with a release store and read with an
acquire load, so whoever sees the pointer sees the initialized dentry_meta.
debugfs_lookup() now also returns NULL for such a node.
Reported by: llm-postcr