1 From: Tony Jones <tonyj@suse.de>
2 Subject: Add a struct vfsmount parameter to vfs_mknod()
4 The vfsmount will be passed down to the LSM hook so that LSMs can compute
7 Signed-off-by: Tony Jones <tonyj@suse.de>
8 Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
9 Signed-off-by: John Johansen <jjohansen@suse.de>
12 fs/ecryptfs/inode.c | 5 ++++-
13 fs/namei.c | 10 ++++++----
15 include/linux/fs.h | 2 +-
16 net/unix/af_unix.c | 3 ++-
17 5 files changed, 15 insertions(+), 8 deletions(-)
19 --- a/fs/ecryptfs/inode.c
20 +++ b/fs/ecryptfs/inode.c
21 @@ -552,11 +552,14 @@ ecryptfs_mknod(struct inode *dir, struct
24 struct dentry *lower_dentry;
25 + struct vfsmount *lower_mnt;
26 struct dentry *lower_dir_dentry;
28 lower_dentry = ecryptfs_dentry_to_lower(dentry);
29 + lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
30 lower_dir_dentry = lock_parent(lower_dentry);
31 - rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev);
32 + rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, lower_mnt, mode,
34 if (rc || !lower_dentry->d_inode)
36 rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
39 @@ -1976,7 +1976,8 @@ fail:
41 EXPORT_SYMBOL_GPL(lookup_create);
43 -int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
44 +int vfs_mknod(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
45 + int mode, dev_t dev)
47 int error = may_create(dir, dentry, 0);
49 @@ -2054,11 +2055,12 @@ SYSCALL_DEFINE4(mknodat, int, dfd, const
50 error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
52 case S_IFCHR: case S_IFBLK:
53 - error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,
54 - new_decode_dev(dev));
55 + error = vfs_mknod(nd.path.dentry->d_inode, dentry,
56 + nd.path, mode, new_decode_dev(dev));
58 case S_IFIFO: case S_IFSOCK:
59 - error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
60 + error = vfs_mknod(nd.path.dentry->d_inode, dentry,
64 mnt_drop_write(nd.path.mnt);
67 @@ -1306,7 +1306,8 @@ nfsd_create(struct svc_rqst *rqstp, stru
71 - host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
72 + host_err = vfs_mknod(dirp, dchild, exp->ex_path.mnt,
73 + iap->ia_mode, rdev);
77 --- a/include/linux/fs.h
78 +++ b/include/linux/fs.h
79 @@ -1179,7 +1179,7 @@ extern void unlock_super(struct super_bl
80 extern int vfs_permission(struct nameidata *, int);
81 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
82 extern int vfs_mkdir(struct inode *, struct dentry *, struct vfsmount *, int);
83 -extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
84 +extern int vfs_mknod(struct inode *, struct dentry *, struct vfsmount *, int, dev_t);
85 extern int vfs_symlink(struct inode *, struct dentry *, const char *);
86 extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
87 extern int vfs_rmdir(struct inode *, struct dentry *);
88 --- a/net/unix/af_unix.c
89 +++ b/net/unix/af_unix.c
90 @@ -827,7 +827,8 @@ static int unix_bind(struct socket *sock
91 err = mnt_want_write(nd.path.mnt);
94 - err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0);
95 + err = vfs_mknod(nd.path.dentry->d_inode, dentry, nd.path.mnt,
97 mnt_drop_write(nd.path.mnt);