]> git.baikalelectronics.ru Git - kernel.git/commit
nfsd4: readdirplus shouldn't return parent of export
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 11 Jan 2021 21:01:29 +0000 (16:01 -0500)
committerChuck Lever <chuck.lever@oracle.com>
Tue, 12 Jan 2021 13:54:14 +0000 (08:54 -0500)
commit0a3a41c8e652b40611fb385596bc52e8a9effbf9
treea7cd4b8dd7aaaab11192b44a51b8cd9acf441ad9
parentf0efdd8116990417b4f52a8ce0ccbd589674eae1
nfsd4: readdirplus shouldn't return parent of export

If you export a subdirectory of a filesystem, a READDIRPLUS on the root
of that export will return the filehandle of the parent with the ".."
entry.

The filehandle is optional, so let's just not return the filehandle for
".." if we're at the root of an export.

Note that once the client learns one filehandle outside of the export,
they can trivially access the rest of the export using further lookups.

However, it is also not very difficult to guess filehandles outside of
the export.  So exporting a subdirectory of a filesystem should
considered equivalent to providing access to the entire filesystem.  To
avoid confusion, we recommend only exporting entire filesystems.

Reported-by: Youjipeng <wangzhibei1999@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs3xdr.c