]> git.ipfire.org Git - people/arne_f/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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Jan 2021 14:38:18 +0000 (15:38 +0100)
commit2174b2cf3960b9091c2516feeb9e345fe24f8906
treec7b24ea5b9b5514679cf22f254fa7d4a4d9cd11a
parente739d7501b2ee2a23a0b10e11a09b8fc45804c28
nfsd4: readdirplus shouldn't return parent of export

commit 51b2ee7d006a736a9126e8111d1f24e4fd0afaa6 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs3xdr.c