Skip to content
Commit b5191b2d authored by Greg Kurz's avatar Greg Kurz Committed by Michael Roth
Browse files

9pfs: forbid . and .. in file names

According to the 9P spec http://man.cat-v.org/plan_9/5/open

 about the
create request:

The names . and .. are special; it is illegal to create files with these
names.

This patch causes the create and lcreate requests to fail with EINVAL if
the file name is either "." or "..".

Even if it isn't explicitly written in the spec, this patch extends the
checking to all requests that may cause a directory entry to be created:

    - mknod
    - rename
    - renameat
    - mkdir
    - link
    - symlink

The unlinkat request also gets patched for consistency (even if
rmdir("foo/..") is expected to fail according to POSIX.1-2001).

The various error values come from the linux manual pages.

Suggested-by: default avatarPeter Maydell <peter.maydell@linaro.org>
Signed-off-by: default avatarGreg Kurz <groug@kaod.org>
Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 805b5d98)
Signed-off-by: default avatarMichael Roth <mdroth@linux.vnet.ibm.com>
parent 917e9a98
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment