aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/fs/devpts
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2018-03-13 17:55:26 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-03-14 13:31:23 +0100
commit4e15f760a43c7cb88e2b7ad6882501ccab5de29f (patch)
tree793c2b9f7c9ab69c218794ffba643ecdd77777b4 /fs/devpts
parentdevpts: resolve devpts bind-mounts (diff)
downloadwireguard-linux-4e15f760a43c7cb88e2b7ad6882501ccab5de29f.tar.xz
wireguard-linux-4e15f760a43c7cb88e2b7ad6882501ccab5de29f.zip
devpts: comment devpts_mntget()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Acked-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/devpts')
-rw-r--r--fs/devpts/inode.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 542364bf923e..e072e955ce33 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -152,6 +152,24 @@ static int devpts_ptmx_path(struct path *path)
return 0;
}
+/*
+ * Try to find a suitable devpts filesystem. We support the following
+ * scenarios:
+ * - The ptmx device node is located in the same directory as the devpts
+ * mount where the pts device nodes are located.
+ * This is e.g. the case when calling open on the /dev/pts/ptmx device
+ * node when the devpts filesystem is mounted at /dev/pts.
+ * - The ptmx device node is located outside the devpts filesystem mount
+ * where the pts device nodes are located. For example, the ptmx device
+ * is a symlink, separate device node, or bind-mount.
+ * A supported scenario is bind-mounting /dev/pts/ptmx to /dev/ptmx and
+ * then calling open on /dev/ptmx. In this case a suitable pts
+ * subdirectory can be found in the common parent directory /dev of the
+ * devpts mount and the ptmx bind-mount, after resolving the /dev/ptmx
+ * bind-mount.
+ * If no suitable pts subdirectory can be found this function will fail.
+ * This is e.g. the case when bind-mounting /dev/pts/ptmx to /ptmx.
+ */
struct vfsmount *devpts_mntget(struct file *filp, struct pts_fs_info *fsi)
{
struct path path;