Re: [PATCH v1] fs: Fix error checking for d_hash_and_lookup()

From: Christian Brauner
Date: Thu Jul 13 2023 - 12:45:32 EST


On Thu, 13 Jul 2023 20:05:42 +0800, Wang Ming wrote:
> The d_hash_and_lookup() function returns error pointers or NULL.
> Most incorrect error checks were fixed, but the one in int path_pts()
> was forgotten.
>
>

That one is valid but the chance of running into this issue is almost
zero. For this to be a problem a ptmx device node must have been created
on a filesystem with a custom hash function that cannot hash a three
ascii char string. The only filesystem that would reject this is
efivarfs because it has very specific expectations about naming. But it
neither allows the creation of symlinks nor device nodes and bind-mounts
of ptmx don't have that issue.

The only other candidate would be ntfs and only if an oom condition
hits. But the ntfs driver can't create any files so that device node
would have to preexist.

So all in all mostly an academic issue but still.

---

Applied to the vfs.fixes branch of the vfs/vfs.git tree.
Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] fs: Fix error checking for d_hash_and_lookup()
https://git.kernel.org/vfs/vfs/c/5ad699137e4a