aboutsummaryrefslogtreecommitdiffstats
path: root/net/unix/af_unix.c
diff options
context:
space:
mode:
authorChristian Brauner <[email protected]>2021-01-21 13:19:33 +0000
committerChristian Brauner <[email protected]>2021-01-24 13:27:18 +0000
commit6521f8917082928a4cb637eb64b77b5f2f5b30fc (patch)
treeece638b5b444e7aff9e6e132d7c0c16788d7583e /net/unix/af_unix.c
parentnamei: introduce struct renamedata (diff)
downloadkernel-6521f8917082928a4cb637eb64b77b5f2f5b30fc.tar.gz
kernel-6521f8917082928a4cb637eb64b77b5f2f5b30fc.zip
namei: prepare for idmapped mounts
The various vfs_*() helpers are called by filesystems or by the vfs itself to perform core operations such as create, link, mkdir, mknod, rename, rmdir, tmpfile and unlink. Enable them to handle idmapped mounts. If the inode is accessed through an idmapped mount map it into the mount's user namespace and pass it down. Afterwards the checks and operations are identical to non-idmapped mounts. If the initial user namespace is passed nothing changes so non-idmapped mounts will see identical behavior as before. Link: https://lore.kernel.org/r/[email protected] Cc: Christoph Hellwig <[email protected]> Cc: David Howells <[email protected]> Cc: Al Viro <[email protected]> Cc: [email protected] Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
Diffstat (limited to 'net/unix/af_unix.c')
-rw-r--r--net/unix/af_unix.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 18453d15dddf..9a1f3c04402e 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -996,7 +996,8 @@ static int unix_mknod(const char *sun_path, umode_t mode, struct path *res)
*/
err = security_path_mknod(&path, dentry, mode, 0);
if (!err) {
- err = vfs_mknod(d_inode(path.dentry), dentry, mode, 0);
+ err = vfs_mknod(&init_user_ns, d_inode(path.dentry), dentry,
+ mode, 0);
if (!err) {
res->mnt = mntget(path.mnt);
res->dentry = dget(dentry);